mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Added love.filesystem.isSymlink, love.filesystem.setSymlinksEnabled, and love.filesystem.areSymlinksEnabled. Symbolic link support is disabled by default.
love.filesystem.isSymlink will always return false when symbolic link support is disabled, even if the given filepath is actually a symlink.
This commit is contained in:
@@ -661,6 +661,21 @@ int64 Filesystem::getSize(const char *filename) const
|
||||
return size;
|
||||
}
|
||||
|
||||
void Filesystem::setSymlinksEnabled(bool enable)
|
||||
{
|
||||
PHYSFS_permitSymbolicLinks(enable ? 1 : 0);
|
||||
}
|
||||
|
||||
bool Filesystem::areSymlinksEnabled() const
|
||||
{
|
||||
return PHYSFS_symbolicLinksPermitted() != 0;
|
||||
}
|
||||
|
||||
bool Filesystem::isSymlink(const char *filename) const
|
||||
{
|
||||
return PHYSFS_isSymbolicLink(filename) != 0;
|
||||
}
|
||||
|
||||
} // physfs
|
||||
} // filesystem
|
||||
} // love
|
||||
|
||||
@@ -247,6 +247,22 @@ public:
|
||||
**/
|
||||
int64 getSize(const char *filename) const;
|
||||
|
||||
/**
|
||||
* Enable or disable symbolic link support in love.filesystem.
|
||||
**/
|
||||
void setSymlinksEnabled(bool enable);
|
||||
|
||||
/**
|
||||
* Gets whether symbolic link support is enabled.
|
||||
**/
|
||||
bool areSymlinksEnabled() const;
|
||||
|
||||
/**
|
||||
* Gets whether a filepath is actually a symlink.
|
||||
* Always returns false if symlinks are not enabled.
|
||||
**/
|
||||
bool isSymlink(const char *filename) const;
|
||||
|
||||
/**
|
||||
* Text file line-reading iterator function used and
|
||||
* pushed on the Lua stack by love.filesystem.lines
|
||||
|
||||
Reference in New Issue
Block a user