Skip to content

Commit 007fe56

Browse files
authored
XCode - addons with correct paths now (#335)
1 parent 8a3a744 commit 007fe56

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

ofxProjectGenerator/src/projects/baseProject.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ bool isPlatformName(std::string file){
4747
}
4848

4949
std::unique_ptr<baseProject::Template> baseProject::parseTemplate(const ofDirectory & templateDir){
50-
auto name = ofFilePath::getBaseName(templateDir.getOriginalDirectory());
50+
auto name = of::filesystem::path(templateDir.getOriginalDirectory()).parent_path().filename();
5151
if(templateDir.isDirectory() && !isPlatformName(name)){
5252
ofBuffer templateconfig;
5353
ofFile templateconfigFile(ofFilePath::join(templateDir.path(), "template.config"));
@@ -136,6 +136,7 @@ bool baseProject::create(const of::filesystem::path & _path, std::string templat
136136
if(!ret) return false;
137137

138138
if(templateName!=""){
139+
auto name = ofFilePath::join(getOFRoot(),templatesFolder + templateName);
139140
ofDirectory templateDir(ofFilePath::join(getOFRoot(),templatesFolder + templateName));
140141
templateDir.setShowHidden(true);
141142
auto templateConfig = parseTemplate(templateDir);

ofxProjectGenerator/src/projects/xcodeProject.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ bool xcodeProject::createProjectFile(){
127127
}
128128

129129
// make everything relative the right way.
130-
string relRoot = getOFRelPathFS(projectDir).string();
130+
relRoot = getOFRelPathFS(projectDir).string();
131131
projectDir = projectDir.lexically_normal();
132132

133133
//projectDir is always absolute at the moment
@@ -197,7 +197,7 @@ void xcodeProject::renameProject(){ //base
197197
}
198198
}
199199

200-
string xcodeProject::getFolderUUID(string folder) {
200+
string xcodeProject::getFolderUUID(string folder, bool isFolder) {
201201
string UUID = "";
202202
if ( folderUUID.find(folder) == folderUUID.end() ) { // NOT FOUND
203203
vector < string > folders = ofSplitString(folder, "/", true);
@@ -217,7 +217,10 @@ string xcodeProject::getFolderUUID(string folder) {
217217

218218
// here we add an UUID for the group (folder) and we initialize an array to receive children (files or folders inside)
219219
commands.emplace_back("Add :objects:"+thisUUID+":isa string PBXGroup");
220-
commands.emplace_back("Add :objects:"+thisUUID+":name string "+folders[a]);
220+
if (isFolder) {
221+
commands.emplace_back("Add :objects:"+thisUUID+":path string " + relRoot + "/" + fullPath);
222+
}
223+
commands.emplace_back("Add :objects:"+thisUUID+":name string " + folders[a]);
221224
commands.emplace_back("Add :objects:"+thisUUID+":children array");
222225
// commands.emplace_back("Add :objects:"+thisUUID+":sourceTree string <group>");
223226
commands.emplace_back("Add :objects:"+thisUUID+":sourceTree string SOURCE_ROOT");
@@ -452,7 +455,7 @@ void xcodeProject::addFramework(string name, string path, string folder){
452455

453456
// we add one of the build refs to the list of frameworks
454457
// TENTATIVA desesperada aqui...
455-
string folderUUID = getFolderUUID(folder);
458+
string folderUUID = getFolderUUID(folder, false);
456459
commands.emplace_back("Add :objects:"+folderUUID+":children: string " + UUID);
457460

458461
//commands.emplace_back("Add :objects:"+frameworksUUID+":children array");
@@ -496,7 +499,7 @@ void xcodeProject::addFramework(string name, string path, string folder){
496499
// finally, this is for making folders based on the frameworks position in the addon. so it can appear in the sidebar / file explorer
497500

498501
if (folder.size() > 0 && !ofIsStringInString(folder, "/System/Library/Frameworks")){
499-
string folderUUID = getFolderUUID(folder);
502+
string folderUUID = getFolderUUID(folder, false);
500503
} else {
501504
//FIXME: else what?
502505
}

ofxProjectGenerator/src/projects/xcodeProject.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,7 @@ class xcodeProject : public baseProject {
6565
std::map <string, string> folderUUID = {
6666
};
6767

68-
string getFolderUUID(string folder);
68+
string getFolderUUID(string folder, bool isFolder = true);
69+
70+
string relRoot = "../../..";
6971
};

0 commit comments

Comments
 (0)