Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set working directory from cli #402

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions qdlt/qdltoptmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,11 @@ void QDltOptManager::parse(QStringList *opt)
}
++i;
}
else if (str.compare("-w") == 0)
{
workingDirectory = opt->value(i+1);
++i;
}
else if(opt->at(i).endsWith(".dlt") || opt->at(i).endsWith(".DLT"))
{
if (convert == true)
Expand Down Expand Up @@ -368,3 +373,4 @@ QString QDltOptManager::getConvertDestFile(){return convertDestFile;}
QString QDltOptManager::getPluginName(){return pluginName;}
QString QDltOptManager::getCommandName(){return commandName;}
QStringList QDltOptManager::getCommandParams(){return commandParams;}
QString QDltOptManager::getWorkingDirectory() const { return workingDirectory; }
2 changes: 2 additions & 0 deletions qdlt/qdltoptmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class QDLT_EXPORT QDltOptManager
QString getPluginName();
QString getCommandName();
QStringList getCommandParams();
QString getWorkingDirectory() const;

private:
QDltOptManager();
Expand All @@ -85,6 +86,7 @@ class QDLT_EXPORT QDltOptManager
QString pluginName;
QString commandName;
QStringList commandParams;
QString workingDirectory;
};

#endif //QDLTOPTMANAGER_H
7 changes: 6 additions & 1 deletion src/workingdirectory.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "workingdirectory.h"

#include "qdltsettingsmanager.h"
#include "qdltoptmanager.h"

// See workingdirectory.h for documentation.

Expand Down Expand Up @@ -44,7 +45,11 @@ QString WorkingDirectory::getDirectory(WorkingDirectoryType type, QString extra)
QString ret = "";
QString key = createKeyFor(type, extra);

if(type == WorkingDirectory::PluginConfig)
if (!QDltOptManager::getInstance()->getWorkingDirectory().isEmpty())
{
ret = QDltOptManager::getInstance()->getWorkingDirectory();
}
else if(type == WorkingDirectory::PluginConfig)
{
ret = QDltSettingsManager::getInstance()->value(key, "plugins/").toString();
}
Expand Down