Java : How to get contents of a folder(path)
Iam a beginner with Mps and began to struggle the last days on a small task.
I would like to get all .xml file names of one folder.
My first idea was to do it like this(what should work..at least it does in Visual Studio).
File f = new File(path);
ArrayList<String> names = new ArrayList<String>(Arrays.asList(f.list("*.xml")));
I guess there is missing some kind of include for Mps to know the syntax.
I would appreciate any tips :)
Please sign in to leave a comment.
You have to import (Control/Cmd + M) the model holding java.util classes, that is java.util@java_stub
Thanks alot for the fast answer.I imported the model u told me but it still doesnt recognice the keyword "File"
Also is there a way to view the used models?
File is in java.io, I think. So you have to import that one, as well.
The imported models are visible in the properties of your sandbox model - right-click on the model node in the left-hand-side Project View panel and choose "model properties".
Here you can find the details about dependencies - https://confluence.jetbrains.com/display/MPSD20171/Getting+the+dependencies+right
Maybe you could consider checking out the tutorial to quickly grasp the fundamentals - https://confluence.jetbrains.com/display/MPSD20171/Fast+Track+to+MPS
Vaclav
Thanks Veclav.I think a rebuild was required.At least it does work now.Thanks alot!