diff --git a/afanasy/src/include/afanasy.h b/afanasy/src/include/afanasy.h index 7edc8a21d..09b72f702 100644 --- a/afanasy/src/include/afanasy.h +++ b/afanasy/src/include/afanasy.h @@ -24,8 +24,12 @@ namespace AFGENERAL { #ifdef WINNT const char STORE_FOLDER[] = "\\afanasy"; +const char OPEN_FOLDER_CMD[] = "explorer"; +const char PATH_SEPARATOR = '\\'; #else const char STORE_FOLDER[] = "/var/tmp/afanasy"; +const char OPEN_FOLDER_CMD[] = "openfolder"; +const char PATH_SEPARATOR = '/'; #endif const char TIME_FORMAT[] = "%a %d %b %H:%M.%S"; ///< Default time output format. @@ -36,11 +40,6 @@ const int MAX_RUNNING_TASKS = -1; ///< Default maximum running tasks numbe const int MAX_RUN_TASKS_PER_HOST = -1; ///< Default maximum running tasks per host. const int JOBS_LIFE_TIME = -1; ///< Default user jobs life time. const int FILE_NAME_SIZE_MAX = 250; ///< Maximum filename size. -#ifdef WINNT -const char PATH_SEPARATOR = '\\'; -#else -const char PATH_SEPARATOR = '/'; -#endif const char FILENAME_INVALID_CHARACTERS[] = "\"\\ /|!$&?()[]{}*^<>%`',:;"; const size_t FILENAME_INVALID_CHARACTERS_LENGTH = strlen(FILENAME_INVALID_CHARACTERS); const char FILENAME_INVALID_CHARACTER_REPLACE = '_'; diff --git a/afanasy/src/libafanasy/environment.cpp b/afanasy/src/libafanasy/environment.cpp index 32bb343a3..28844b31a 100644 --- a/afanasy/src/libafanasy/environment.cpp +++ b/afanasy/src/libafanasy/environment.cpp @@ -75,6 +75,8 @@ std::string Environment::rules_url; std::vector Environment::projects_root; std::vector Environment::render_windowsmustdie; +std::string Environment::open_folder_cmd = AFGENERAL::OPEN_FOLDER_CMD; + std::string Environment::cmd_shell = AFRENDER::CMD_SHELL; std::string Environment::render_cmd_reboot = AFRENDER::CMD_REBOOT; @@ -239,6 +241,7 @@ void Environment::getVars( const JSON * i_obj) getVar( i_obj, timeformat, "timeformat" ); getVar( i_obj, previewcmds, "previewcmds" ); getVar( i_obj, annotations, "annotations" ); + getVar( i_obj, open_folder_cmd, "open_folder_cmd" ); getVar( i_obj, cmd_shell, "cmd_shell" ); getVar( i_obj, icons_path, "icons_path" ); diff --git a/afanasy/src/libafanasy/environment.h b/afanasy/src/libafanasy/environment.h index 0c31d5d39..6334adeba 100644 --- a/afanasy/src/libafanasy/environment.h +++ b/afanasy/src/libafanasy/environment.h @@ -159,6 +159,8 @@ class Environment static inline int getWOLWakeInterval() { return wolwake_interval; } + static inline std::string & getOpenFolderCmd() {return open_folder_cmd;} + static inline std::string & getCmdShell() { return cmd_shell;} static inline int getRenderNice() { return render_nice; } @@ -334,6 +336,8 @@ class Environment static int render_nice; ///< Render task process nice factor. static std::vector render_windowsmustdie; + static std::string open_folder_cmd; + static std::string cmd_shell; static std::string render_cmd_reboot; static std::string render_cmd_shutdown; diff --git a/afanasy/src/watch/watch.cpp b/afanasy/src/watch/watch.cpp index 031a4268e..0239b020c 100644 --- a/afanasy/src/watch/watch.cpp +++ b/afanasy/src/watch/watch.cpp @@ -590,12 +590,10 @@ void Watch::browseFolder( const QString & i_folder, const QString & i_wdir) } Watch::displayInfo( QString("Opening '%1'").arg( dir.path().toUtf8().data())); -#ifdef WINNT - QString cmd = "explorer"; -#else - QString cmd = "openfolder"; -#endif - cmd += " \"" + i_folder + "\""; + + QString cmd = afqt::stoq(af::Environment::getOpenFolderCmd()); + cmd = cmd.replace("@PATH@", i_folder); + Watch::startProcess( cmd, i_wdir); }