diff --git a/bazaar/Functions4U/Functions4U.cpp b/bazaar/Functions4U/Functions4U.cpp index 9794c2cf7..17f74d86a 100644 --- a/bazaar/Functions4U/Functions4U.cpp +++ b/bazaar/Functions4U/Functions4U.cpp @@ -698,6 +698,15 @@ String GetSystemFolder() return String(ret); } +#ifdef PLATFORM_WIN32 +String GetCommonAppDataFolder() { + wchar path[MAX_PATH]; + if(SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, 0, path) == S_OK) + return FromUnicodeBuffer(path); + return Null; +} +#endif + bool SetEnv(const char *id, const char *val) { // EnvMap().Put(WString(id), WString(val)); diff --git a/bazaar/Functions4U/Functions4U.h b/bazaar/Functions4U/Functions4U.h index 1e5e9901a..84ae4f7cc 100644 --- a/bazaar/Functions4U/Functions4U.h +++ b/bazaar/Functions4U/Functions4U.h @@ -86,7 +86,7 @@ Vector SearchFile(String dir, const Vector &condFiles, const Vec const Vector &extFiles, const Vector &extFolders, const String text, Vector &errorList); Vector SearchFile(String dir, String condFile, String text, Vector &errorList);//, int flags = 0); -Vector SearchFile(String dir, String condFile, String text = "");//, int flags = 0); +Vector SearchFile(String dir, String condFile = "*.*", String text = "");//, int flags = 0); /////////////////////////////// bool FileToTrashBin(const char *path); @@ -98,6 +98,9 @@ String GetRootFolder(); String GetTempFolder(); String GetOsFolder(); String GetSystemFolder(); +#ifdef PLATFORM_WIN32 +String GetCommonAppDataFolder(); +#endif bool SetEnv(const char *id, const char *val); struct FileData : Moveable { @@ -243,6 +246,10 @@ template inline bool Between(const T& val, const T& min, const T& max) { return val >= min && val <= max; } +template +inline T BetweenVal(const T& val, const T& _min, const T& _max) { + return max(_min, min(_max, val)); +} #define IsNan(a) ((a) != (a)) @@ -619,7 +626,10 @@ public: int GetStatus() {return status;} bool IsRunning() {return status > 0;} Gate4 WhenTimer; - + #ifdef PLATFORM_WIN32 + DWORD GetPid() {return p.GetPid();} + #endif + private: LocalProcess2 p; TimeStop timeElapsed, timeToTimeout;