Fixed a bug in handling windoze driver letter ":" notation.
This commit is contained in:
parent
28436a23be
commit
c5427a287d
2 changed files with 12 additions and 1 deletions
|
@ -28,12 +28,19 @@
|
||||||
|
|
||||||
// If Unix, replace all ":" with "/". If MacOS, replace all "/" with
|
// If Unix, replace all ":" with "/". If MacOS, replace all "/" with
|
||||||
// ":" it should go without saying that neither of these characters
|
// ":" it should go without saying that neither of these characters
|
||||||
// should be used in file or directory names.
|
// should be used in file or directory names. In windoze, allow the
|
||||||
|
// second character to be a ":" for things like c:\foo\bar
|
||||||
|
|
||||||
static string fix_path( const string path ) {
|
static string fix_path( const string path ) {
|
||||||
string result = path;
|
string result = path;
|
||||||
|
|
||||||
for ( int i = 0; i < (int)path.size(); ++i ) {
|
for ( int i = 0; i < (int)path.size(); ++i ) {
|
||||||
|
#if defined( WIN32 )
|
||||||
|
// for windoze, don't replace the ":" for the second character
|
||||||
|
if ( i == 1 ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if ( result[i] == FG_BAD_PATH_SEP ) {
|
if ( result[i] == FG_BAD_PATH_SEP ) {
|
||||||
result[i] = FG_PATH_SEP;
|
result[i] = FG_PATH_SEP;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,10 @@
|
||||||
#define _FGPATH_HXX
|
#define _FGPATH_HXX
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <Include/compiler.h>
|
#include <Include/compiler.h>
|
||||||
|
|
||||||
#include STL_STRING
|
#include STL_STRING
|
||||||
|
|
Loading…
Reference in a new issue