Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orion-dev] Getting File Project Location

Hi Diana,

It feels a bit brittle to be doing that kind of path manipulation but I can't think of a good alternative. In theory the Git repository can be rooted at arbitrary depth in the workspace tree, and CloneLocation is indeed a reliable indicator of the root location for the repository. I am not aware of any other client-side mechanism to compute this.

John






From:        Diana Chen <dianac@xxxxxxxxxxxx>
To:        Orion developer discussions <orion-dev@xxxxxxxxxxx>
Date:        07/23/2015 06:39 PM
Subject:        [orion-dev] Getting File Project Location
Sent by:        orion-dev-bounces@xxxxxxxxxxx




Hey all,

Is there an easy way to get the project root?

For example:
Jon imports a project from a Git repository, gitRepo, into the editor. In gitRepo, he has a folder “folderA” with a file “sillyFile.txt". The location of the file (in the file metadata) is "/file/Jon-OrionContent/gitRepo/sillyFile.txt”. I would like to get the path relative to the repo, just “folderA/sillyFile.txt” in this case.

So far I’ve used the File API to get the File object’s Git object and then taken the CloneLocation “/gitapi/clone/file/Jon-OrionContent/gitRepo/“ and removed the “/gitapi/clone“ substring to get “/file/Jon-OrionContent/gitRepo/“ as the project root.

I’ve looked into fileClient and fileUtils and haven’t found anything for this purpopse. Is there a way to do this without any requests, maybe using something similar to the fileClient? Is there a better way than pulling it from the Git CloneLocation?

Thanks!
Diana



_______________________________________________
orion-dev mailing list
orion-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/orion-dev

Back to the top