From c9c772613ca96ff54548eb720069f3858d42f34a Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Mon, 7 Sep 2015 17:10:14 -0300 Subject: [PATCH] Enable symlinks by default (resolves issue #1072.) --- src/modules/filesystem/physfs/Filesystem.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/modules/filesystem/physfs/Filesystem.cpp b/src/modules/filesystem/physfs/Filesystem.cpp index fcf73417f..fe2a563d4 100644 --- a/src/modules/filesystem/physfs/Filesystem.cpp +++ b/src/modules/filesystem/physfs/Filesystem.cpp @@ -125,12 +125,8 @@ void Filesystem::init(const char *arg0) if (!PHYSFS_init(arg0)) 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) @@ -664,6 +660,17 @@ int64 Filesystem::getSize(const char *filename) const 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); }