I'm trying to create an Xcode plugin that should read all files contained in the project opened in Xcode and do further work with files names(Extract images names). The question is how to get the directory/path of the main bundle of the project opened in Xcode.
Thank you.
In Xcode select the blue project file (top left) in the navigation bar. In the Identity and Type Inspector ⌥⌘1 on the right click on the little arrow after the Full Path below Location . Show activity on this post. Yes, this is your project folder.
Enter the files name in the bottom bar (search field) of the Project Navigator (on the left side), press enter => there it is ;-) Fantastic!
Importing into Xcode Select the file and click Open. Xcode will open the project. On the left side you will see the Project Navigator, with a folder representing your project by name. From here you can expand the folders and explore their contents.
Hi this way you can find the current project path from plugin
NSArray *workspaceWindowControllers = [NSClassFromString(@"IDEWorkspaceWindowController") valueForKey:@"workspaceWindowControllers"];
id workSpace;
for (id controller in workspaceWindowControllers) {
if ([[controller valueForKey:@"window"] isEqual:[NSApp keyWindow]]) {
workSpace = [controller valueForKey:@"_workspace"];
}
}
NSString *workspacePath = [[workSpace valueForKey:@"representingFilePath"] valueForKey:@"_pathString"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With