Commit ea099b2a authored by bonnell's avatar bonnell
Browse files

Fix reading of config files and hosts on windows

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@10974 18c085ea-50e0-402c-830e-de6fd14e8384
parent b257e2fb
...@@ -130,6 +130,9 @@ VisItFstat(int fd, VisItStat_t *buf) ...@@ -130,6 +130,9 @@ VisItFstat(int fd, VisItStat_t *buf)
// Hank Childs, Thu Jun 8 16:13:20 PDT 2006 // Hank Childs, Thu Jun 8 16:13:20 PDT 2006
// Fix warning regarding uninitialized variable. // Fix warning regarding uninitialized variable.
// //
// Kathleen Bonnell, Thu Apr 22 17:23:43 MST 2010
// Add '.' to test for isDir on Windows.
//
// **************************************************************************** // ****************************************************************************
bool bool
...@@ -169,8 +172,10 @@ ReadAndProcessDirectory(const std::string &directory, ...@@ -169,8 +172,10 @@ ReadAndProcessDirectory(const std::string &directory,
{ {
do do
{ {
bool isDir = ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) || bool isDir =
(strcmp(fd.cFileName, "..") == 0); ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) ||
(strcmp(fd.cFileName, "..") == 0) ||
(strcmp(fd.cFileName, ".") == 0) ;
long sz = ((fd.nFileSizeHigh * MAXDWORD) + fd.nFileSizeLow); long sz = ((fd.nFileSizeHigh * MAXDWORD) + fd.nFileSizeLow);
std::string fileName(directory); std::string fileName(directory);
if(directory.substr(directory.size() - 1) != "\\") if(directory.substr(directory.size() - 1) != "\\")
......
...@@ -94,6 +94,9 @@ static bool isDevelopmentVersion = false; ...@@ -94,6 +94,9 @@ static bool isDevelopmentVersion = false;
// Tom Fogal, Sun Apr 19 11:39:50 MST 2009 // Tom Fogal, Sun Apr 19 11:39:50 MST 2009
// Use `Environment' to simplify and fix a compilation error. // Use `Environment' to simplify and fix a compilation error.
// //
// Kathleen Bonnell, Thu Apr 22 17:25:54 MST 2010
// Username no longer added to config file names on windows.
//
// **************************************************************************** // ****************************************************************************
char * char *
...@@ -149,29 +152,13 @@ GetDefaultConfigFile(const char *filename, const char *home) ...@@ -149,29 +152,13 @@ GetDefaultConfigFile(const char *filename, const char *home)
if(!realhome.empty()) if(!realhome.empty())
{ {
if(home == NULL) retval = new char[realhome.length() + filenameLength + 2];
{ sprintf(retval, "%s\\%s", realhome.c_str(), configFileName);
// User config. Get the username so we can append it to
// the filename.
DWORD namelen = 100;
char username[100];
GetUserName(username, &namelen);
retval = new char[realhome.length() + namelen + 5 + filenameLength + 2 + 7];
sprintf(retval, "%s\\%s for %s.ini", realhome.c_str(),
configFileName, username);
}
else
{
// System config.
retval = new char[realhome.length() + filenameLength + 2 + 7];
sprintf(retval, "%s\\%s.ini", realhome.c_str(), configFileName);
}
} }
else else
{ {
retval = new char[filenameLength + 1 + 4]; retval = new char[filenameLength + 1];
sprintf(retval, "%s.ini", configFileName); sprintf(retval, "%s", configFileName);
} }
#else #else
// The file it is assumed to be in the home directory unless the home // The file it is assumed to be in the home directory unless the home
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment