How do I navigate from a project uri in Rascal to the files it contains?

StackOverflow https://stackoverflow.com/questions/19114729

  •  30-06-2022
  •  | 
  •  

문제

I would like to parse all the files in a project. Suppose I have a location like |project://p2-SnakesAndLadders|, how can I navigate to the files in the project?

도움이 되었습니까?

해결책

Locations have an ls field, so you could type something like

|project://p2-SnakesAndLadders|.ls

to get back all the files and directories at the root level of the project as a list. You can then use functions isFile and isDirectory (both of which are in the prelude, so they are available by default) to distinguish between file and directory locations.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top