From 29b3207fe433497c60feff0b1f71b7fdb27412e1 Mon Sep 17 00:00:00 2001 From: Boroondas Gupte Date: Fri, 11 Feb 2011 01:27:01 +0100 Subject: OPEN-29 Error out if lldir_.h is included when building for a different platform As far as I know, there is no good reason to include e.g. indra/llvfs/lldir_win32.h while not building for a windows target, so be better prevent this to avoid hard to find errors. --- indra/llvfs/lldir_linux.h | 4 ++++ indra/llvfs/lldir_mac.h | 4 ++++ indra/llvfs/lldir_solaris.h | 4 ++++ indra/llvfs/lldir_win32.h | 4 ++++ 4 files changed, 16 insertions(+) (limited to 'indra/llvfs') diff --git a/indra/llvfs/lldir_linux.h b/indra/llvfs/lldir_linux.h index 451e81ae93..c7cfe905f5 100644 --- a/indra/llvfs/lldir_linux.h +++ b/indra/llvfs/lldir_linux.h @@ -24,6 +24,10 @@ * $/LicenseInfo$ */ +#if !LL_LINUX +#error This header must not be included when compiling for any target other than Linux. Consider including lldir.h instead. +#endif // !LL_LINUX + #ifndef LL_LLDIR_LINUX_H #define LL_LLDIR_LINUX_H diff --git a/indra/llvfs/lldir_mac.h b/indra/llvfs/lldir_mac.h index 4eac3c3ae6..6bde458bf6 100644 --- a/indra/llvfs/lldir_mac.h +++ b/indra/llvfs/lldir_mac.h @@ -24,6 +24,10 @@ * $/LicenseInfo$ */ +#if !LL_DARWIN +#error This header must not be included when compiling for any target other than Mac OS. Consider including lldir.h instead. +#endif // !LL_DARWIN + #ifndef LL_LLDIR_MAC_H #define LL_LLDIR_MAC_H diff --git a/indra/llvfs/lldir_solaris.h b/indra/llvfs/lldir_solaris.h index 4a1794f539..b48752d362 100644 --- a/indra/llvfs/lldir_solaris.h +++ b/indra/llvfs/lldir_solaris.h @@ -24,6 +24,10 @@ * $/LicenseInfo$ */ +#if !LL_SOLARIS +#error This header must not be included when compiling for any target other than Solaris. Consider including lldir.h instead. +#endif // !LL_SOLARIS + #ifndef LL_LLDIR_SOLARIS_H #define LL_LLDIR_SOLARIS_H diff --git a/indra/llvfs/lldir_win32.h b/indra/llvfs/lldir_win32.h index 4c932c932c..1d0a692883 100644 --- a/indra/llvfs/lldir_win32.h +++ b/indra/llvfs/lldir_win32.h @@ -24,6 +24,10 @@ * $/LicenseInfo$ */ +#if !LL_WINDOWS +#error This header must not be included when compiling for any target other than Windows. Consider including lldir.h instead. +#endif // !LL_WINDOWS + #ifndef LL_LLDIR_WIN32_H #define LL_LLDIR_WIN32_H -- cgit v1.2.3 From 627c7634398e03145f297e91a8e93c0bbba00e33 Mon Sep 17 00:00:00 2001 From: Boroondas Gupte Date: Fri, 11 Feb 2011 01:35:21 +0100 Subject: =?UTF-8?q?OPEN-29=20Cleanup:=20removed=20extra=20qualification=20?= =?UTF-8?q?=E2=80=98LLDir=5FWin32::=E2=80=99=20on=20member=20=E2=80=98getN?= =?UTF-8?q?extFileInDir=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before OPEN-29, when lldir_win32.h would have been included when building for Linux, GCC would error out with indra/llvfs/lldir_win32.h:50: error: extra qualification ‘LLDir_Win32::’ on member ‘getNextFileInDir’ which, although unintended, probably was a Good Thing (TM), as this would have aborted the build, so that the wrong include would be noticed. Now that we explicitly error out with a (hopefully) useful error message, this isn't needed anymore. --- indra/llvfs/lldir_win32.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llvfs') diff --git a/indra/llvfs/lldir_win32.h b/indra/llvfs/lldir_win32.h index 1d0a692883..8a97a248dd 100644 --- a/indra/llvfs/lldir_win32.h +++ b/indra/llvfs/lldir_win32.h @@ -51,7 +51,7 @@ public: /*virtual*/ std::string getLLPluginFilename(std::string base_name); private: - BOOL LLDir_Win32::getNextFileInDir(const llutf16string &dirname, const std::string &mask, std::string &fname); + BOOL getNextFileInDir(const llutf16string &dirname, const std::string &mask, std::string &fname); void* mDirSearch_h; llutf16string mCurrentDir; -- cgit v1.2.3 From 1c931920af96e8ef4fd7f923b58f23b2bee869ee Mon Sep 17 00:00:00 2001 From: Boroondas Gupte Date: Fri, 11 Feb 2011 01:41:34 +0100 Subject: OPEN-29 Cleanup: removed superflous "public:" Not related, just a while-I'm-at-it thing. --- indra/llvfs/lldir_linux.h | 2 +- indra/llvfs/lldir_mac.h | 2 +- indra/llvfs/lldir_solaris.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llvfs') diff --git a/indra/llvfs/lldir_linux.h b/indra/llvfs/lldir_linux.h index c7cfe905f5..6015b25faa 100644 --- a/indra/llvfs/lldir_linux.h +++ b/indra/llvfs/lldir_linux.h @@ -44,7 +44,7 @@ public: /*virtual*/ void initAppDirs(const std::string &app_name, const std::string& app_read_only_data_dir); -public: + virtual std::string getCurPath(); virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask); virtual BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname); diff --git a/indra/llvfs/lldir_mac.h b/indra/llvfs/lldir_mac.h index 6bde458bf6..b456d3afca 100644 --- a/indra/llvfs/lldir_mac.h +++ b/indra/llvfs/lldir_mac.h @@ -43,7 +43,7 @@ public: /*virtual*/ void initAppDirs(const std::string &app_name, const std::string& app_read_only_data_dir); -public: + virtual S32 deleteFilesInDir(const std::string &dirname, const std::string &mask); virtual std::string getCurPath(); virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask); diff --git a/indra/llvfs/lldir_solaris.h b/indra/llvfs/lldir_solaris.h index b48752d362..5623254758 100644 --- a/indra/llvfs/lldir_solaris.h +++ b/indra/llvfs/lldir_solaris.h @@ -44,7 +44,7 @@ public: /*virtual*/ void initAppDirs(const std::string &app_name, const std::string& app_read_only_data_dir); -public: + virtual std::string getCurPath(); virtual U32 countFilesInDir(const std::string &dirname, const std::string &mask); virtual BOOL getNextFileInDir(const std::string &dirname, const std::string &mask, std::string &fname); -- cgit v1.2.3 From 1d0001020716d3f3d3734dd4a4f8cd609bc2b215 Mon Sep 17 00:00:00 2001 From: Boroondas Gupte Date: Fri, 11 Feb 2011 02:09:20 +0100 Subject: OPEN-29 Cleanup: strip trailing whitespace As people will have to rebuild half the tree anyway, because these headers changed, we might as well prettify them a bit. --- indra/llvfs/lldir_linux.h | 4 ++-- indra/llvfs/lldir_solaris.h | 2 +- indra/llvfs/lldir_win32.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/llvfs') diff --git a/indra/llvfs/lldir_linux.h b/indra/llvfs/lldir_linux.h index 6015b25faa..a34de1241d 100644 --- a/indra/llvfs/lldir_linux.h +++ b/indra/llvfs/lldir_linux.h @@ -1,6 +1,6 @@ /** * @file lldir_linux.h - * @brief Definition of directory utilities class for linux + * @brief Definition of directory utilities class for linux * * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code @@ -57,7 +57,7 @@ private: DIR *mDirp; int mCurrentDirIndex; int mCurrentDirCount; - std::string mCurrentDir; + std::string mCurrentDir; }; #endif // LL_LLDIR_LINUX_H diff --git a/indra/llvfs/lldir_solaris.h b/indra/llvfs/lldir_solaris.h index 5623254758..70fac6f818 100644 --- a/indra/llvfs/lldir_solaris.h +++ b/indra/llvfs/lldir_solaris.h @@ -54,7 +54,7 @@ private: DIR *mDirp; int mCurrentDirIndex; int mCurrentDirCount; - std::string mCurrentDir; + std::string mCurrentDir; }; #endif // LL_LLDIR_SOLARIS_H diff --git a/indra/llvfs/lldir_win32.h b/indra/llvfs/lldir_win32.h index 8a97a248dd..b170ebbcd7 100644 --- a/indra/llvfs/lldir_win32.h +++ b/indra/llvfs/lldir_win32.h @@ -52,7 +52,7 @@ public: private: BOOL getNextFileInDir(const llutf16string &dirname, const std::string &mask, std::string &fname); - + void* mDirSearch_h; llutf16string mCurrentDir; }; -- cgit v1.2.3 From c98996e684911bb12986d9493269b39ac1b9a59a Mon Sep 17 00:00:00 2001 From: Alain Linden Date: Tue, 15 Feb 2011 12:03:45 -0800 Subject: fix test failure caused by dubious method for testing an empty string. --- indra/llvfs/lldir_win32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llvfs') diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp index 33718e520d..b9a3995e25 100644 --- a/indra/llvfs/lldir_win32.cpp +++ b/indra/llvfs/lldir_win32.cpp @@ -249,7 +249,7 @@ BOOL LLDir_Win32::getNextFileInDir(const std::string &dirname, const std::string if (pathname != mCurrentDir) { // different dir specified, close old search - if (mCurrentDir[0]) + if (!mCurrentDir.empty()) { FindClose(mDirSearch_h); } -- cgit v1.2.3 From 83a42e91d43c1d9c1b57fc664ce3d6171205e751 Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Thu, 17 Feb 2011 16:20:58 -0800 Subject: Ported over mani's patch for handling finding of the RO appdata dir when running from the debugger. ported from changeset https://hg.lindenlab.com/alain/indra-common/changeset/99a9d1876e83/ reviewed by Richard. --- indra/llvfs/lldir_win32.cpp | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'indra/llvfs') diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp index b9a3995e25..4e2a55f4b3 100644 --- a/indra/llvfs/lldir_win32.cpp +++ b/indra/llvfs/lldir_win32.cpp @@ -81,10 +81,11 @@ LLDir_Win32::LLDir_Win32() // fprintf(stderr, "mTempDir = <%s>",mTempDir); -#if 1 - // Don't use the real app path for now, as we'll have to add parsing to detect if - // we're in a developer tree, which has a different structure from the installed product. + // Set working directory, for LLDir::getWorkingDir() + GetCurrentDirectory(MAX_PATH, w_str); + mWorkingDir = utf16str_to_utf8str(llutf16string(w_str)); + // Set the executable directory S32 size = GetModuleFileName(NULL, w_str, MAX_PATH); if (size) { @@ -100,32 +101,35 @@ LLDir_Win32::LLDir_Win32() { mExecutableFilename = mExecutablePathAndName; } - GetCurrentDirectory(MAX_PATH, w_str); - mWorkingDir = utf16str_to_utf8str(llutf16string(w_str)); } else { fprintf(stderr, "Couldn't get APP path, assuming current directory!"); - GetCurrentDirectory(MAX_PATH, w_str); - mExecutableDir = utf16str_to_utf8str(llutf16string(w_str)); + mExecutableDir = mWorkingDir; // Assume it's the current directory } -#else - GetCurrentDirectory(MAX_PATH, w_str); - mExecutableDir = utf16str_to_utf8str(llutf16string(w_str)); -#endif - if (mExecutableDir.find("indra") == std::string::npos) + // mAppRODataDir = "."; + + // Determine the location of the App-Read-Only-Data + // Try the working directory then the exe's dir. + mAppRODataDir = mWorkingDir; + + +// if (mExecutableDir.find("indra") == std::string::npos) + + // *NOTE:Mani - It is a mistake to put viewer specific code in + // the LLDir implementation. The references to 'skins' and + // 'llplugin' need to go somewhere else. + // alas... this also gets called during static initialization + // time due to the construction of gDirUtil in lldir.cpp. + if(! LLFile::isdir(mAppRODataDir + mDirDelimiter + "skins")) { - // Running from installed directory. Make sure current - // directory isn't something crazy (e.g. if invoking from - // command line). - SetCurrentDirectory(utf8str_to_utf16str(mExecutableDir).c_str()); - GetCurrentDirectory(MAX_PATH, w_str); - mWorkingDir = utf16str_to_utf8str(llutf16string(w_str)); + // What? No skins in the working dir? + // Try the executable's directory. + mAppRODataDir = mExecutableDir; } - mAppRODataDir = mWorkingDir; llinfos << "mAppRODataDir = " << mAppRODataDir << llendl; -- cgit v1.2.3 From 8886460a22a6cc6307dd0909219b4dd442c55f8d Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 9 Mar 2011 00:21:57 -0800 Subject: SOCIAL-654 WIP Items purchased on Marketplace.secondlife.com while logged into Minimal skin are declined and not present in inventory made notification text skinnable --- indra/llvfs/lldir.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/llvfs') diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index cb898e385f..341c96f6ea 100644 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -149,7 +149,11 @@ const std::string LLDir::findFile(const std::string& filename, const std::vector { if (!search_path_iter->empty()) { - std::string filename_and_path = (*search_path_iter) + getDirDelimiter() + filename; + std::string filename_and_path = (*search_path_iter); + if (!filename.empty()) + { + filename_and_path += getDirDelimiter() + filename; + } if (fileExists(filename_and_path)) { return filename_and_path; -- cgit v1.2.3