Skip to content

Commit

Permalink
luaPath
Browse files Browse the repository at this point in the history
  • Loading branch information
dxli committed Sep 12, 2023
1 parent 0046648 commit 5117979
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions lcUI/operationloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,38 +57,10 @@ class FolderFinder

bool isValid(const std::string& path) const
{
std::cout<<"Test "<<path.c_str() + operationsLua<<": "<<QFileInfo{QString{path.c_str()} + operationsLua}.exists();
std::cout<<"Test "<<path + operationsLua<<": "<<QFileInfo{QString{path.c_str()} + operationsLua}.exists();
return QFileInfo{QString{path.c_str()} + operationsLua}.exists();
}
};


std::string findLuaFolder(std::string luaPath)
{
if (QFileInfo{QString{luaPath.c_str()} + operationsLua}.exists())
return luaPath;
luaPath = QDir{QCoreApplication::applicationDirPath()}.canonicalPath().toStdString();
#if (defined (LINUX) || defined (__linux__))
luaPath += "/../share/librecad/lcUILua/";
#endif
if (QFileInfo{QString{luaPath.c_str()} + operationsLua}.exists())
return luaPath;

QDirIterator it(QString{luaPath.c_str()}, QDirIterator::Subdirectories);

// Iterate through the directory using the QDirIterator
while (it.hasNext())
{
QString folder = it.next();
QFileInfo file(folder);
if (!file.isDir())
continue;

if (QDir{folder}.dirName() == QString{"lcUILua"})
return folder.toStdString();
}
return luaPath;
}
}


Expand Down

0 comments on commit 5117979

Please sign in to comment.