Remove love.filesystem.remove()

This commit is contained in:
Rob Loach 2022-04-16 23:38:27 -04:00
parent 40fc1aee12
commit f9fd2777d0
No known key found for this signature in database
GPG Key ID: 627C60834A74A21A
5 changed files with 3 additions and 31 deletions

View File

@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixes ### Fixes
- Fix playing empty ogg files through `libretro-common`, by @phcoder - Fix playing empty ogg files through `libretro-common`, by @phcoder
### Changed
- `love.filesystem.remove()` has been removed
## 1.2.1 - 2022-03-07 ## 1.2.1 - 2022-03-07
### Fixes ### Fixes
- Update `libretro-common` for audio fixes - Update `libretro-common` for audio fixes

View File

@ -383,15 +383,6 @@ std::vector<std::string> filesystem::lines(const std::string& filename, const st
return strings; return strings;
} }
bool filesystem::remove(const std::string& name) {
int ret = PHYSFS_delete(name.c_str());
if (ret == 0) {
std::cout << "[ChaiLove] [filesystem] Failed to remove file or directory: " << getLastError() << std::endl;
return false;
}
return true;
}
FileInfo filesystem::getInfo(const std::string& path) { FileInfo filesystem::getInfo(const std::string& path) {
FileInfo fileInfo; FileInfo fileInfo;
PHYSFS_Stat stat; PHYSFS_Stat stat;

View File

@ -82,19 +82,6 @@ class filesystem {
std::string getBasename(const std::string& filepath); std::string getBasename(const std::string& filepath);
std::string getParentDirectory(const std::string& filepath); std::string getParentDirectory(const std::string& filepath);
/**
* Removes a file or empty directory.
*
* The directory must be empty before removal or else it will fail. Simply remove all files and folders in the directory beforehand.
* If the file exists in the .love but not in the save directory, it returns false as well.
* An opened File prevents removal of the underlying file. Simply close the File to remove it.
*
* @param name The file or directory to remove.
*
* @return True if the file or directory was removed, false otherwise.
*/
bool remove(const std::string& name);
/** /**
* Gets information about the specified file or directory. * Gets information about the specified file or directory.
* *

View File

@ -325,7 +325,6 @@ script::script(const std::string& file) {
chai.add(fun(&filesystem::isSymlink), "isSymlink"); chai.add(fun(&filesystem::isSymlink), "isSymlink");
chai.add(fun(&filesystem::isFile), "isFile"); chai.add(fun(&filesystem::isFile), "isFile");
chai.add(fun(&filesystem::write), "write"); chai.add(fun(&filesystem::write), "write");
chai.add(fun(&filesystem::remove), "remove");
chai.add(fun(&filesystem::exists), "exists"); chai.add(fun(&filesystem::exists), "exists");
chai.add(fun(&filesystem::getExecutablePath), "getExecutablePath"); chai.add(fun(&filesystem::getExecutablePath), "getExecutablePath");
chai.add(fun(&filesystem::getSaveDirectory), "getSaveDirectory"); chai.add(fun(&filesystem::getSaveDirectory), "getSaveDirectory");

View File

@ -69,14 +69,6 @@ assert(createDirectoryReturn, "love.filesystem.createDirectory()")
var writeFileReturn = love.filesystem.write("test/unittests/createDirectoryTest/test.md", "# Test\n\nHello World!"); var writeFileReturn = love.filesystem.write("test/unittests/createDirectoryTest/test.md", "# Test\n\nHello World!");
assert(writeFileReturn, "love.filesystem.write()") assert(writeFileReturn, "love.filesystem.write()")
// remove()
assert(love.filesystem.exists("createDirectoryTest/test.md"), "love.filesystem.remove()")
assert(love.filesystem.exists("createDirectoryTest"), " directory exists")
assert(love.filesystem.remove("test/unittests/createDirectoryTest/test.md"), " remove file")
assert_not(love.filesystem.exists("createDirectoryTest/test.md"), " file is gone")
assert(love.filesystem.remove("test/unittests/createDirectoryTest"), " remove directory")
assert_not(love.filesystem.exists("createDirectoryTest"), " directory is gone")
// mount() // mount()
var mountResult = love.filesystem.mount("assets/hello.zip", "hello") var mountResult = love.filesystem.mount("assets/hello.zip", "hello")
assert(mountResult, "love.filesystem.mount()") assert(mountResult, "love.filesystem.mount()")