diff common/portpath.c @ 164:6d64d7e9fa32

Implemented port_dirname for windows.
author Sascha Wilde <wilde@intevation.de>
date Tue, 25 Mar 2014 12:01:26 +0100
parents 306e4db11761
children d47de01d6ad7
line wrap: on
line diff
--- a/common/portpath.c	Tue Mar 25 09:30:51 2014 +0100
+++ b/common/portpath.c	Tue Mar 25 12:01:26 2014 +0100
@@ -12,10 +12,14 @@
 #ifndef _WIN32
   return dirname(path);
 #else
-  fprintf(stderr, "Windows Suport missing!");
-  abort();
+  char drive[_MAX_DRIVE];
+  char dir[_MAX_DIR];
+  _splitpath(path, drive, dir, NULL, NULL);
+  /* We assume: drive + dir is shorter than
+   * drive + dir + fname + ext */
+  sprintf(path, "%s%s", drive, dir);
+  return path;
 #endif
- 
 }
 
 char *

http://wald.intevation.org/projects/trustbridge/