stream: add file::exists and file::readonly

We are targeting C++14, while C++17 already has std::filesystem::exists. 😢

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
2023-09-20 13:00:15 +02:00
parent dcfc4752b5
commit 6689aa5210
3 changed files with 64 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
/*
/*
SPDX-License-Identifier: MIT
Copyright © 2023 Amebis
*/
@@ -26,6 +26,7 @@ int main(int argc, const char * argv[])
UnitTests::stream::async();
UnitTests::stream::replicator();
UnitTests::stream::open_close();
UnitTests::stream::file_stat();
UnitTests::unicode::str2wstr();
UnitTests::unicode::wstr2str();
UnitTests::unicode::charset_encoder();

View File

@@ -139,6 +139,13 @@ namespace UnitTests
std::filesystem::remove(filename[i]);
}
TEST_METHOD(file_stat)
{
sstring path(temp_path());
Assert::IsTrue(stdex::stream::file::exists(path));
Assert::IsFalse(stdex::stream::file::readonly(path));
}
protected:
static sstring temp_path()
{