]> git.mxchange.org Git - simgear.git/blobdiff - simgear/misc/sg_path.cxx
Add a function to calculate the normalmap from a regular texture.
[simgear.git] / simgear / misc / sg_path.cxx
index f21a523cbee0436a063a0f9bc38966be9de8d19d..54f7138dbcde9167cb979b3a93a74a769107c340 100644 (file)
@@ -3,7 +3,7 @@
 //
 // Written by Curtis L. Olson, started April 1999.
 //
-// Copyright (C) 1999  Curtis L. Olson - curt@flightgear.org
+// Copyright (C) 1999  Curtis L. Olson - http://www.flightgear.org/~curt
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Library General Public
@@ -43,7 +43,7 @@ static const char sgDirPathSep = '/';
 static const char sgDirPathSepBad = '\\';
 #endif
 
-#if defined( WIN32 )
+#if defined( WIN32 ) && !defined(__CYGWIN__)
 static const char sgSearchPathSep = ';';
 #else
 static const char sgSearchPathSep = ':';
@@ -154,7 +154,7 @@ string SGPath::dir() const {
 // get the base part of the path (everything but the extension.)
 string SGPath::base() const {
     int index = path.rfind(".");
-    if (index >= 0) {
+    if ((index >= 0) && (path.find("/", index) == string::npos)) {
        return path.substr(0, index);
     } else {
        return "";
@@ -162,9 +162,11 @@ string SGPath::base() const {
 }
 
 // get the extention (everything after the final ".")
+// but make sure no "/" follows the "." character (otherwise it
+// is has to be a directory name containing a ".").
 string SGPath::extension() const {
     int index = path.rfind(".");
-    if (index >= 0) {
+    if ((index >= 0)  && (path.find("/", index) == string::npos)) {
        return path.substr(index + 1);
     } else {
        return "";