*Functions4U: Fixed null params in LaunchFile

git-svn-id: svn://ultimatepp.org/upp/trunk@15296 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2020-10-23 09:18:04 +00:00
parent 94015fde34
commit 6dcc195a5e
2 changed files with 11 additions and 56 deletions

View file

@ -123,7 +123,7 @@ String GetDesktopManagerNew() {
bool LaunchFile(const char *_file, const char *_params, const char *) {
String file = UnixPath(_file);
String params = UnixPath(_params);
String params = _params == nullptr ? "" : UnixPath(_params);
int ret;
if (GetDesktopManagerNew() == "gnome")
ret = system("gnome-open \"" + file + "\" " + params);
@ -2823,11 +2823,11 @@ bool SetConsoleColor(CONSOLE_COLOR color) {
if (hstdout == 0) {
hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
if (!GetConsoleScreenBufferInfo(hstdout, &csbiInfo)) {
hstdout = 0;
return false;
}
woldattrs = csbiInfo.wAttributes;
//if (!GetConsoleScreenBufferInfo(hstdout, &csbiInfo)) {
// hstdout = 0;
// return false;
//}
woldattrs = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED; //csbiInfo.wAttributes;
}
if (color == RESET)
return SetConsoleTextAttribute(hstdout, woldattrs);
@ -2869,4 +2869,6 @@ void ConsoleOutputDisable(bool disable) {
#endif
}
}

View file

@ -24,7 +24,7 @@ enum EXT_FILE_FLAGS {NO_FLAG = 0,
String GetDesktopManagerNew();
bool LaunchFile(const char *file, const char *params = 0, const char *directory = ".");
bool LaunchFile(const char *file, const char *params = nullptr, const char *directory = ".");
bool FileCat(const char *file, const char *appendFile);
@ -630,54 +630,7 @@ struct TempAssign {
/* Replaced with std::atomic
template <class T>
class ThreadSafe {
public:
inline ThreadSafe() {val = Null;}
inline ThreadSafe(T v) {operator=(v);}
inline void operator=(T v) {
mutex.Enter();
val = v;
mutex.Leave();
}
inline void operator+=(T v) {
mutex.Enter();
val += v;
mutex.Leave();
}
inline void operator-=(T v) {
mutex.Enter();
val -= v;
mutex.Leave();
}
inline operator T() {
T ret;
mutex.Enter();
ret = val;
mutex.Leave();
return ret;
}
Value GetData() {
Value ret;
mutex.Enter();
ret = val;
mutex.Leave();
return ret;
}
Value operator~() const {return GetData();}
inline ThreadSafe& operator++() {
mutex.Enter();
val++;
mutex.Leave();
return *this;
}
inline ThreadSafe operator++(int) {
ThreadSafe tmp = *this;
++*this;
return tmp;
}
private:
Mutex mutex;
T val;
...
};*/
template <class C>
@ -1238,7 +1191,7 @@ enum CONSOLE_COLOR {
bool SetConsoleColor(CONSOLE_COLOR color);
void ConsoleOutputDisable(bool disable);
}
#endif