Sanitize paths before use
authordpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Wed, 5 Mar 2008 16:12:13 +0000 (16:12 +0000)
committerdpage <dpage@a7884b65-44f6-0310-8a51-81a127f17b15>
Wed, 5 Mar 2008 16:12:13 +0000 (16:12 +0000)
git-svn-id: svn://svn.pgadmin.org/trunk/pgadmin3@7138 a7884b65-44f6-0310-8a51-81a127f17b15

pgadmin/pgAdmin3.cpp

index 7382fa7bd60e6e85422b413cf6d7ed5eae8131fb..e0eb786dd30f06f8889e23bc513f72f08087e58b 100644 (file)
@@ -267,6 +267,7 @@ bool pgAdmin3::OnInit()
     wxLogInfo(wxT("UI path      : %s"), uiPath.c_str());
     wxLogInfo(wxT("Doc path     : %s"), docPath.c_str());
     wxLogInfo(wxT("Branding path: %s"), brandingPath.c_str());
+    wxLogInfo(wxT("Utilities INI: %s"), utilitiesIni.c_str());
 
     wxLogInfo(wxT("PG pg_dump    : %s"), pgBackupExecutable.c_str());
     wxLogInfo(wxT("PG pg_dumpall : %s"), pgBackupAllExecutable.c_str());
@@ -911,6 +912,51 @@ void pgAdmin3::InitPaths()
         edbBackupAllExecutable = wxEmptyString;
     if (!isEdbApp(edbRestoreExecutable))
         edbRestoreExecutable = wxEmptyString;
+
+    // Now sanitize all the paths
+    wxFileName thePath;
+    if (loadPath.Length())
+    {
+        thePath = wxFileName::DirName(loadPath);
+        thePath.Normalize();
+        loadPath = thePath.GetLongPath();
+    }
+
+    if (docPath.Length())
+    {
+        thePath = wxFileName::DirName(docPath);
+        thePath.Normalize();
+        docPath = thePath.GetLongPath();
+    }
+
+    if (uiPath.Length())
+    {
+        thePath = wxFileName::DirName(uiPath);
+        thePath.Normalize();
+        uiPath = thePath.GetLongPath();
+    }
+
+    if (i18nPath.Length())
+    {
+        thePath = wxFileName::DirName(i18nPath);
+        thePath.Normalize();
+        i18nPath = thePath.GetLongPath();
+    }
+
+    if (brandingPath.Length())
+    {
+        thePath = wxFileName::DirName(brandingPath);
+        thePath.Normalize();
+        brandingPath = thePath.GetLongPath();
+    }
+
+    if (utilitiesIni.Length())
+    {
+        thePath = wxFileName::FileName(utilitiesIni);
+        thePath.Normalize();
+        utilitiesIni = thePath.GetLongPath();
+    }
+
 }
 
 void pgAdmin3::InitHelp()