pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] [pingus] 2 new revisions pushed by address@hidden on 2011-1


From: pingus
Subject: [Pingus-CVS] [pingus] 2 new revisions pushed by address@hidden on 2011-10-14 16:52 GMT
Date: Fri, 14 Oct 2011 16:57:29 +0000

2 new revisions:

Revision: d67aa5e0bea8
Author:   Ingo Ruhnke <address@hidden>
Date:     Fri Oct 14 09:49:39 2011
Log: Cut of the drive name from the fullpath in Win32 so it's not duplicate...
http://code.google.com/p/pingus/source/detail?r=d67aa5e0bea8

Revision: 284ab029f291
Author:   Ingo Ruhnke <address@hidden>
Date:     Fri Oct 14 09:52:35 2011
Log: Require press of enter to update path, which is a little less troubles...
http://code.google.com/p/pingus/source/detail?r=284ab029f291

==============================================================================
Revision: d67aa5e0bea8
Author:   Ingo Ruhnke <address@hidden>
Date:     Fri Oct 14 09:49:39 2011
Log: Cut of the drive name from the fullpath in Win32 so it's not duplicate when both are joined again

Fixes issue 93

http://code.google.com/p/pingus/source/detail?r=d67aa5e0bea8

Modified:
 /src/util/system.cpp

=======================================
--- /src/util/system.cpp        Tue Oct 11 14:42:55 2011
+++ /src/util/system.cpp        Fri Oct 14 09:49:39 2011
@@ -509,41 +509,50 @@
 {
   std::string fullpath;
   std::string drive;
-
-  if (pathname.size() > 0 && pathname[0] == '/')
-  {
-    fullpath = pathname;
-  }
+
 #ifdef WIN32
-  else if (pathname.size() > 2 && pathname[1] == ':' && pathname[2] == '/')
-  {
+  if (pathname.size() > 2 && pathname[1] == ':' && pathname[2] == '/')
+  {
+    // absolute path on Win32
     drive = pathname.substr(0, 2);
+    fullpath = pathname.substr(2);
+  }
+#else
+  if (pathname.size() > 0 && pathname[0] == '/')
+  {
+    // absolute path on Linux
     fullpath = pathname;
   }
 #endif
   else
   {
+    // relative path
     char* cwd = getcwd(NULL, 0);
     if (!cwd)
     {
       log_error("System::realpath: Error: couldn't getcwd()");
       return pathname;
     }
-#ifdef WIN32
-    for (char *p = cwd; *p; ++p)
-    {
-      if (*p == '\\')
-        *p = '/';
-    }
-    drive.assign(cwd, 2);
+    else
+    {
+#ifdef WIN32
+      // unify directory separator to '/'
+      for (char *p = cwd; *p; ++p)
+      {
+        if (*p == '\\')
+          *p = '/';
+      }
+      drive.assign(cwd, 2);
+      fullpath = Pathname::join(std::string(cwd+2), pathname);
+#else
+      fullpath = Pathname::join(std::string(cwd), pathname);
 #endif
-
-    fullpath = Pathname::join(std::string(cwd), pathname);
-    free(cwd);
+      free(cwd);
+    }
   }

 #ifdef WIN32
-  return drive + "/" + normalize_path(fullpath);
+  return drive + normalize_path(fullpath);
 #else
   return normalize_path(fullpath);
 #endif

==============================================================================
Revision: 284ab029f291
Author:   Ingo Ruhnke <address@hidden>
Date:     Fri Oct 14 09:52:35 2011
Log: Require press of enter to update path, which is a little less troublesome then automatic realtime updates

http://code.google.com/p/pingus/source/detail?r=284ab029f291

Modified:
 /src/editor/file_dialog.cpp

=======================================
--- /src/editor/file_dialog.cpp Tue Oct 11 08:42:27 2011
+++ /src/editor/file_dialog.cpp Fri Oct 14 09:52:35 2011
@@ -81,7 +81,7 @@
pathname_inputbox = create<Inputbox>(Rect(4 + 60, 4+60, rect.get_width()-4, 26+60));

filename_inputbox->on_enter.connect(std::bind(&FileDialog::on_filename_enter, this)); - pathname_inputbox->on_change.connect(std::bind(&FileDialog::on_pathname_change, this)); + pathname_inputbox->on_enter.connect(std::bind(&FileDialog::on_pathname_change, this));
 }

 FileDialog::~FileDialog()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]