FuzzkingCool Posted May 10, 2018 Report Share Posted May 10, 2018 Hiya! Is there a way to get the root of a workspace or it's selector given an arbitrary filepath from within in the workspace itself? I have several workspaces, but I want to find the root of path programmatically, so I can work with that particular workspace in my python code. So for instance, I have the path: "C:\users\admin\wkspaces\workspace1\Assets\thing.txt". If I use: Quote cm showselector C:\users\admin\wkspaces\workspace1\Assets\thing.txt I get a print out of the selector file itself, something like: Quote Selector for workspace1: repository "studio_test@ssl://#############:8088" path "/" br "/main" co "/main" Which is not that helpful for my purposes.... Why is the path "/" ??? Its the same for every workspace afaik so this seems to be useless. What is this meant to represent? I have also considered using "cm lwk" and then comparing the start of the given file path with these, BUT what if there is more than one workspace for a branch? I would have to make a dictionary that compares the selector output from each of these workspaces, and filter through those. However this doesn't solve my problem since the workspace path I need is a network mounted drive and the "cm lwk" only shows workspaces with local paths, even though workspace was created on the local machine. I actually wrote a method that walks up paths until it finds the .plastic folder and parses the selector, and then obviously I have the root of the workspace/repo at this point, but this is obviously a bit expensive... Seems to me that this would be a very helpful method to simply tell what the root of the workspace for a given path when working with pipeline development. May I suggest that we get a parameter for the "showselector" method to get the root of the workspace on the local file system? Thanks for reading! - Aleks Link to comment Share on other sites More sharing options...
manu Posted May 11, 2018 Report Share Posted May 11, 2018 Hi @karmakat, you will get it by using the "getworkspacefrompath" command, an example: c:\Users\mluci\wkspaces\UnityGame1\Assets\scripts>cm gwp . --format={1} c:\Users\mluci\wkspaces\UnityGame1 or c:\>cm gwp c:\Users\mluci\wkspaces\UnityGame1\Assets\scripts\AddMultishot.cs --format={1} c:\Users\mluci\wkspaces\UnityGame1 Hope it helps! Link to comment Share on other sites More sharing options...
FuzzkingCool Posted May 11, 2018 Author Report Share Posted May 11, 2018 Oh wow....embarrassed I missed that somehow in the "cm showcommands --all" Yeesh. Thanks Manu! Link to comment Share on other sites More sharing options...
manu Posted May 11, 2018 Report Share Posted May 11, 2018 Hahaha no problem at all! Here to help! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.