Skip to content

Commit

Permalink
local addons changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitre committed Nov 26, 2024
1 parent 0d4e7c3 commit 543b944
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
9 changes: 7 additions & 2 deletions commandLine/src/addons/ofAddon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ bool ofAddon::load(string addonName, const fs::path& projectDir, const string& t
// we want to set addonMakeName before cleaning the addon name, so it is preserved in the exact same way as it was passed, and the addons.make file can be (re)constructed properly
this->addonMakeName = addonName;

addonName = cleanName(addonName);
// addonName = cleanName(addonName);

if(addonName.empty()){
ofLogError("baseProject::addAddon") << "cant add addon with empty name";
Expand All @@ -899,7 +899,12 @@ bool ofAddon::load(string addonName, const fs::path& projectDir, const string& t
//A local addon is not restricted to one that lives in folder with the name local_addons, should be any valid addon on the filesystem.
//Parsing will generate the correct path to both OF and the project.
//Everything else should be treated exactly in the same way, regardless of it being local or not.
if(addonName[0] == '.' && fs::exists( ofFilePath::join(projectDir, addonName))){

fs::path localAddon { addonName };

if (localAddon.has_parent_path() && fs::exists(projectDir / addonName)) {

// if(addonName[0] == '.' && fs::exists( ofFilePath::join(projectDir, addonName))){

this->addonPath = normalizePath(ofFilePath::join(projectDir, addonName));
this->isLocalAddon = true;
Expand Down
2 changes: 1 addition & 1 deletion commandLine/src/defines.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define OFPROJECTGENERATOR_MAJOR_VERSION "0"
#define OFPROJECTGENERATOR_MINOR_VERSION "86"
#define OFPROJECTGENERATOR_MINOR_VERSION "87"
#define OFPROJECTGENERATOR_PATCH_VERSION "0"

#define PG_VERSION (OFPROJECTGENERATOR_MAJOR_VERSION "." OFPROJECTGENERATOR_MINOR_VERSION "." OFPROJECTGENERATOR_PATCH_VERSION)
Expand Down
13 changes: 9 additions & 4 deletions commandLine/src/projects/baseProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,14 @@ bool baseProject::create(const fs::path & _path, string templateName){

// CWD is already on projectDir. so with this we get relative paths
getFilesRecursively("src", fileNames);

std::sort(fileNames.begin(), fileNames.end(), [](const fs::path & a, const fs::path & b) {
return a.string() < b.string();
});

// FIXME: I think we should remove this logic and remove the files from default project.
// only the files present are added to the project

for (const auto & f : fileNames) {
if (f != "src/ofApp.cpp" &&
f != "src/ofApp.h" &&
Expand Down Expand Up @@ -302,12 +306,13 @@ bool baseProject::isAddonInCache(const string & addonPath, const string platform
return addonsCache[platform].find(addonPath) != addonsCache[platform].end();
}

void baseProject::addAddon(const std::string& _addonName){
void baseProject::addAddon(const std::string & _addonName){
ofLogVerbose("baseProject::addAddon") << _addonName;
// alert( "baseProject::addAddon " + _addonName );

auto addonName = ofAddon::cleanName(_addonName);

// auto addonName = ofAddon::cleanName(_addonName);
auto addonName = _addonName;


// FIXME : not target, yes platform.
//#ifdef TARGET_WIN32
Expand Down
4 changes: 2 additions & 2 deletions commandLine/src/projects/visualStudioProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ void visualStudioProject::appendFilter(string folderName){


void visualStudioProject::addSrc(const fs::path & srcFile, const fs::path & folder, SrcType type){
// alert("addSrc file: " + srcFile.string(), 35);
// alert("addSrc folder: " + folder.string(), 35);
// alert("addSrc file: " + srcFile.string() + " folder: " + folder.string(), 35);

// I had an empty ClCompile field causing errors
if (srcFile.empty()) {
Expand All @@ -239,6 +238,7 @@ void visualStudioProject::addSrc(const fs::path & srcFile, const fs::path & fold
for (std::size_t i = 0; i < folderSubNames.size(); i++){
if (i != 0) folderName += "\\";
folderName += folderSubNames[i];
// alert("appendFilter: " + folderName, 34);
appendFilter(folderName);
}

Expand Down

0 comments on commit 543b944

Please sign in to comment.