summaryrefslogtreecommitdiff
path: root/indra/llvfs
diff options
context:
space:
mode:
authorAdam Moss <moss@lindenlab.com>2009-02-03 17:56:26 +0000
committerAdam Moss <moss@lindenlab.com>2009-02-03 17:56:26 +0000
commite188badaf29a1a02307f93864eed6737096bd9a1 (patch)
tree767259ad3385fd9ede9722e04752bea008469f8c /indra/llvfs
parent4ad54702fce32905402cb6055c085ac14de188a2 (diff)
QAR-1177 maint-viewer-12 + uploadfees-viewer combo mergeme
svn merge -r108355:109316 svn+ssh://svn.lindenlab.com/svn/linden/branches/moss/maint-viewer-12-uploadfees-qa108314 Whew.
Diffstat (limited to 'indra/llvfs')
-rw-r--r--indra/llvfs/lldir.cpp7
-rw-r--r--indra/llvfs/lldir.h5
-rw-r--r--indra/llvfs/lldir_solaris.cpp53
-rw-r--r--indra/llvfs/lldir_solaris.h2
4 files changed, 52 insertions, 15 deletions
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index 07e7a93f9f..d6a6eca341 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -433,7 +433,7 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd
expanded_filename.assign("");
}
- //llinfos << "*** EXPANDED FILENAME: <" << mExpandedFilename << ">" << llendl;
+ //llinfos << "*** EXPANDED FILENAME: <" << expanded_filename << ">" << llendl;
return expanded_filename;
}
@@ -661,6 +661,11 @@ void LLDir::dumpCurrentDirectories()
LL_DEBUGS2("AppInit","Directories") << " TempDir: " << getTempDir() << LL_ENDL;
LL_DEBUGS2("AppInit","Directories") << " CAFile: " << getCAFile() << LL_ENDL;
LL_DEBUGS2("AppInit","Directories") << " SkinDir: " << getSkinDir() << LL_ENDL;
+
+#if LL_LIBXUL_ENABLED
+ LL_DEBUGS2("AppInit","Directories") << " HTML Path: " << getExpandedFilename( LL_PATH_HTML, "" ) << llendl;
+ LL_DEBUGS2("AppInit","Directories") << " Mozilla Profile Path: " << getExpandedFilename( LL_PATH_MOZILLA_PROFILE, "" ) << llendl;
+#endif
}
diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h
index 2bdc0ced00..760b6512a5 100644
--- a/indra/llvfs/lldir.h
+++ b/indra/llvfs/lldir.h
@@ -33,6 +33,11 @@
#ifndef LL_LLDIR_H
#define LL_LLDIR_H
+#if LL_SOLARIS
+#include <sys/param.h>
+#define MAX_PATH MAXPATHLEN
+#endif
+
// these numbers *may* get serialized, so we need to be explicit
typedef enum ELLPath
{
diff --git a/indra/llvfs/lldir_solaris.cpp b/indra/llvfs/lldir_solaris.cpp
index 49e2d3e6c5..9553d923aa 100644
--- a/indra/llvfs/lldir_solaris.cpp
+++ b/indra/llvfs/lldir_solaris.cpp
@@ -37,14 +37,13 @@
#include "llrand.h"
#include <sys/types.h>
#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/param.h>
#include <unistd.h>
#include <glob.h>
#include <pwd.h>
#include <sys/utsname.h>
#define _STRUCTURED_PROC 1
#include <sys/procfs.h>
+#include <fcntl.h>
static std::string getCurrentUserHome(char* fallback)
{
@@ -83,7 +82,16 @@ LLDir_Solaris::LLDir_Solaris()
mDirp = NULL;
char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */
- getcwd(tmp_str, LL_MAX_PATH);
+ if (getcwd(tmp_str, LL_MAX_PATH) == NULL)
+ {
+ strcpy(tmp_str, "/tmp");
+ llwarns << "Could not get current directory; changing to "
+ << tmp_str << llendl;
+ if (chdir(tmp_str) == -1)
+ {
+ llerrs << "Could not change directory to " << tmp_str << llendl;
+ }
+ }
mExecutableFilename = "";
mExecutablePathAndName = "";
@@ -122,20 +130,35 @@ LLDir_Solaris::LLDir_Solaris()
return;
}
+ char *p = execpath; // nuke trash in link, if any exists
+ int i = 0;
+ while(*p != NULL && ++i < LL_MAX_PATH && isprint((int)(*p++)));
+ *p = NULL;
+
mExecutablePathAndName = strdup(execpath);
llinfos << "mExecutablePathAndName = [" << mExecutablePathAndName << "]" << llendl;
+ //NOTE: Why force people to cd into the package directory?
+ // Look for SECONDLIFE env variable and use it, if set.
+
+ char *dcf = getenv("SECONDLIFE");
+ if(dcf != NULL){
+ (void)strcpy(path, dcf);
+ (void)strcat(path, "/bin"); //NOTE: make sure we point at the bin
+ mExecutableDir = strdup(path);
+ }else{
// plunk a null at last '/' to get exec dir
- char *s = execpath + strlen(execpath) -1;
- while(*s != '/' && s != execpath){
- --s;
- }
+ char *s = execpath + strlen(execpath) -1;
+ while(*s != '/' && s != execpath){
+ --s;
+ }
- if(s != execpath){
- *s = (char)NULL;
+ if(s != execpath){
+ *s = (char)NULL;
- mExecutableDir = strdup(execpath);
- llinfos << "mExecutableDir = [" << mExecutableDir << "]" << llendl;
+ mExecutableDir = strdup(execpath);
+ llinfos << "mExecutableDir = [" << mExecutableDir << "]" << llendl;
+ }
}
// *TODO: don't use /tmp, use $HOME/.secondlife/tmp or something.
@@ -355,12 +378,16 @@ void LLDir_Solaris::getRandomFileInDir(const std::string &dirname, const std::st
std::string LLDir_Solaris::getCurPath()
{
char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */
- getcwd(tmp_str, LL_MAX_PATH);
+ if (getcwd(tmp_str, LL_MAX_PATH) == NULL)
+ {
+ llwarns << "Could not get current directory" << llendl;
+ tmp_str[0] = '\0';
+ }
return tmp_str;
}
-BOOL LLDir_Solaris::fileExists(const std::string &filename)
+BOOL LLDir_Solaris::fileExists(const std::string &filename) const
{
struct stat stat_data;
// Check the age of the file
diff --git a/indra/llvfs/lldir_solaris.h b/indra/llvfs/lldir_solaris.h
index f6e7c3cba5..139754ba28 100644
--- a/indra/llvfs/lldir_solaris.h
+++ b/indra/llvfs/lldir_solaris.h
@@ -50,7 +50,7 @@ public:
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, BOOL wrap);
virtual void getRandomFileInDir(const std::string &dirname, const std::string &mask, std::string &fname);
- /*virtual*/ BOOL fileExists(const std::string &filename);
+ /*virtual*/ BOOL fileExists(const std::string &filename) const;
private:
DIR *mDirp;