Using std::filesystem operations in a program built in the SDK results in odd/incorrect file permissions.
Please see this minimal test case:
As you can see, test.out has only w permission, no r permission when copied with
std::filesystem::copy
In SDK:
#include <filesystem>
int main(int argc, char *argv[])
{
std::filesystem::path src(argv[1]);
std::filesystem::path dst(argv[2]);
std::error_code ec;
std::filesystem::copy(src, dst, std::filesystem::copy_options::update_existing, ec);
}
[SailfishOS-4.6.0.11EA-aarch64] upstream # clang++ -std=c++17 test.cpp
[SailfishOS-4.6.0.11EA-aarch64] upstream # ./a.out test.cpp test.out
[SailfishOS-4.6.0.11EA-aarch64] upstream # ls -lh test.*
-rw-r--r-- 1 1001 1001 256 Sep 19 15:43 test.cpp
-rw-r--r-- 1 root root 256 Sep 19 15:46 test.out
On Host:
╰ $ ls -lh test.*
-rw-r--r-- 1 piggz piggz 256 Sep 19 16:43 test.cpp
--w------- 1 piggz piggz 256 Sep 19 16:46 test.out