Skip to content

Commit 74afcd4

Browse files
authored
[macOS] fix for projects inside OF folder but in arbitrary depth (#633)
1 parent 5501ffa commit 74afcd4

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

commandLine/src/defines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define OFPROJECTGENERATOR_MAJOR_VERSION "0"
2-
#define OFPROJECTGENERATOR_MINOR_VERSION "101"
2+
#define OFPROJECTGENERATOR_MINOR_VERSION "102"
33
#define OFPROJECTGENERATOR_PATCH_VERSION "0"
44

55
#define PG_VERSION (OFPROJECTGENERATOR_MAJOR_VERSION "." OFPROJECTGENERATOR_MINOR_VERSION "." OFPROJECTGENERATOR_PATCH_VERSION)

commandLine/src/projects/xcodeProject.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,25 @@ bool xcodeProject::loadProjectFile() { //base
220220
addCommand("Set :objects:E4B69B5B0A3A1756003C02F2:path string " + projectName + "Debug.app");
221221
}
222222

223-
// if ofRoot is not relative to the project path,
224-
// set correct addons and openFrameworks folders
223+
// Next block updates ofPath in xcode addons and openframeworks folder
224+
// only if it is not the usual ../../.. path
225+
226+
bool updateOFPath = false;
227+
fs::path of = getOFRoot();
225228
if (!ofIsPathInPath(fs::current_path(), getOFRoot())) {
226-
addCommand("Set :objects:" + folderUUID["openFrameworks"] + ":path string " + getOFRoot().string() + "/libs/openFrameworks");
229+
updateOFPath = true;
227230
addCommand("Set :objects:" + folderUUID["openFrameworks"] + ":sourceTree string <absolute>");
228-
229-
addCommand("Set :objects:" + folderUUID["addons"] + ":path string " + getOFRoot().string() + "/addons");
230231
addCommand("Set :objects:" + folderUUID["addons"] + ":sourceTree string <absolute>");
232+
} else {
233+
// inside OF Root but not in usual depth
234+
if (!fs::equivalent(getOFRoot(), "../../..")) {
235+
updateOFPath = true;
236+
of = fs::relative(getOFRoot(), fs::current_path());
237+
}
238+
}
239+
if (updateOFPath) {
240+
addCommand("Set :objects:" + folderUUID["openFrameworks"] + ":path string " + of.string() + "/libs/openFrameworks");
241+
addCommand("Set :objects:" + folderUUID["addons"] + ":path string " + of.string() + "/addons");
231242
}
232243

233244
return true;

0 commit comments

Comments
 (0)