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

[sc-dev] SF.net SVN: supercollider: [5723] trunk



Revision: 5723
          http://svn.sourceforge.net/supercollider/?rev=5723&view=rev
Author:   kersten
Date:     2006-12-22 03:19:25 -0800 (Fri, 22 Dec 2006)

Log Message:
-----------
added sc_IsSymlink
reverted sc_ResolveIfAlias to not resolve symlinks on OSX
    (breaks symlink traversal in MyDocument.M)

Modified Paths:
--------------
    trunk/headers/common/SC_DirUtils.h
    trunk/source/common/SC_DirUtils.cpp

Modified: trunk/headers/common/SC_DirUtils.h
===================================================================
--- trunk/headers/common/SC_DirUtils.h	2006-12-22 05:49:22 UTC (rev 5722)
+++ trunk/headers/common/SC_DirUtils.h	2006-12-22 11:19:25 UTC (rev 5723)
@@ -44,6 +44,9 @@
 // Returns the expanded path with users home directory (also in newpath2)
 char *sc_StandardizePath(const char *path, char *newpath2);
 
+// Return TRUE iff 'path' is a symbolic link.
+bool sc_IsSymlink(const char *path);
+
 // Return TRUE iff 'dirname' is an existing directory.
 bool sc_DirectoryExists(const char *dirname);
 

Modified: trunk/source/common/SC_DirUtils.cpp
===================================================================
--- trunk/source/common/SC_DirUtils.cpp	2006-12-22 05:49:22 UTC (rev 5722)
+++ trunk/source/common/SC_DirUtils.cpp	2006-12-22 11:19:25 UTC (rev 5723)
@@ -111,6 +111,17 @@
 #endif
 }
 
+bool sc_IsSymlink(const char* path)
+{
+#if defined(SC_WIN32)
+	// FIXME
+	return false;
+#else
+	struct stat buf;
+	return ((stat(path, &buf) == 0) &&
+			S_ISLNK(buf.st_mode));
+#endif
+}
 
 bool sc_IsNonHostPlatformDir(const char *name)
 {
@@ -163,11 +174,9 @@
 				return;
 			}
 		}
-		if (!realpath(path, returnPath))
-			strcpy(returnPath, path);
-		return;
 	}
 #elif defined(SC_LINUX)
+	isAlias = sc_IsSymlink(path);
 	if (!realpath(path, returnPath))
 		strcpy(returnPath, path);
 	return;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.