Browse Source

Enable symlinks by default (resolves issue #1072.)

Alex Szpakowski 10 years ago
parent
commit
c9c772613c
1 changed files with 13 additions and 6 deletions
  1. 13 6
      src/modules/filesystem/physfs/Filesystem.cpp

+ 13 - 6
src/modules/filesystem/physfs/Filesystem.cpp

@@ -125,12 +125,8 @@ void Filesystem::init(const char *arg0)
 	if (!PHYSFS_init(arg0))
 	if (!PHYSFS_init(arg0))
 		throw love::Exception("%s", PHYSFS_getLastError());
 		throw love::Exception("%s", PHYSFS_getLastError());
 
 
-	PHYSFS_Version version = {};
-	PHYSFS_getLinkedVersion(&version);
-
-	// FIXME: This is a workaround for a bug in PHYSFS_enumerateFiles in 2.1-alpha.
-	if (version.major == 2 && version.minor == 1)
-		PHYSFS_permitSymbolicLinks(1);
+	// Enable symlinks by default. Also fixes an issue in PhysFS 2.1-alpha.
+	setSymlinksEnabled(true);
 }
 }
 
 
 void Filesystem::setFused(bool fused)
 void Filesystem::setFused(bool fused)
@@ -664,6 +660,17 @@ int64 Filesystem::getSize(const char *filename) const
 
 
 void Filesystem::setSymlinksEnabled(bool enable)
 void Filesystem::setSymlinksEnabled(bool enable)
 {
 {
+	if (!enable)
+	{
+		PHYSFS_Version version = {};
+		PHYSFS_getLinkedVersion(&version);
+
+		// FIXME: This is a workaround for a bug in PHYSFS_enumerateFiles in
+		// PhysFS 2.1-alpha.
+		if (version.major == 2 && version.minor == 1)
+			return;
+	}
+
 	PHYSFS_permitSymbolicLinks(enable ? 1 : 0);
 	PHYSFS_permitSymbolicLinks(enable ? 1 : 0);
 }
 }