Skip to content

Commit

Permalink
Set working directory from cli
Browse files Browse the repository at this point in the history
Simplifies working from commandline when required files are in current
directory.

Signed-off-by: Tobias Hammer <[email protected]>
  • Loading branch information
tohammer committed Dec 19, 2023
1 parent e8b6bb9 commit ec421ec
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
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

0 comments on commit ec421ec

Please sign in to comment.