diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d24a3e..2838e4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixes - Fix playing empty ogg files through `libretro-common`, by @phcoder +### Changed +- `love.filesystem.remove()` has been removed + ## 1.2.1 - 2022-03-07 ### Fixes - Update `libretro-common` for audio fixes diff --git a/src/love/filesystem.cpp b/src/love/filesystem.cpp index 65f32b7..0ce0f90 100644 --- a/src/love/filesystem.cpp +++ b/src/love/filesystem.cpp @@ -383,15 +383,6 @@ std::vector filesystem::lines(const std::string& filename, const st 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 fileInfo; PHYSFS_Stat stat; diff --git a/src/love/filesystem.h b/src/love/filesystem.h index 1018e29..bd6e4fa 100644 --- a/src/love/filesystem.h +++ b/src/love/filesystem.h @@ -82,19 +82,6 @@ class filesystem { std::string getBasename(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. * diff --git a/src/love/script.cpp b/src/love/script.cpp index 39717f4..4a7862e 100644 --- a/src/love/script.cpp +++ b/src/love/script.cpp @@ -325,7 +325,6 @@ script::script(const std::string& file) { chai.add(fun(&filesystem::isSymlink), "isSymlink"); chai.add(fun(&filesystem::isFile), "isFile"); chai.add(fun(&filesystem::write), "write"); - chai.add(fun(&filesystem::remove), "remove"); chai.add(fun(&filesystem::exists), "exists"); chai.add(fun(&filesystem::getExecutablePath), "getExecutablePath"); chai.add(fun(&filesystem::getSaveDirectory), "getSaveDirectory"); diff --git a/test/unittests/filesystem.chai b/test/unittests/filesystem.chai index 1860a46..b4fd26e 100644 --- a/test/unittests/filesystem.chai +++ b/test/unittests/filesystem.chai @@ -69,14 +69,6 @@ assert(createDirectoryReturn, "love.filesystem.createDirectory()") var writeFileReturn = love.filesystem.write("test/unittests/createDirectoryTest/test.md", "# Test\n\nHello World!"); 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() var mountResult = love.filesystem.mount("assets/hello.zip", "hello") assert(mountResult, "love.filesystem.mount()")