Skip to content

Commit 2fdff6e

Browse files
authored
mcpplibs.os 0.1.1: names reach the system as UTF-8 (#580)
* mcpplibs.os 0.1.1: names reach the system as UTF-8, never through the code page The patch release of mcpplibs/os#4. On Windows, 0.1.0 narrowed names through the ANSI code page: a name it could not spell ended the program, and one it could spell reached openkal (which reads UTF-8) wrongly. The tests/examples/os consumer moves to 0.1.1 and writes and reads a file whose name is not ASCII. * mcpplibs.os: automatic updates follow the repository's version tags
1 parent 9fc59e0 commit 2fdff6e

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

‎pkgs/o/os.lua‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,19 @@ package = {
1717
repo = "https://github.com/mcpplibs/os",
1818
type = "package",
1919

20+
extensions = {
21+
autoupdate = {
22+
tag = "${version}",
23+
url = "https://github.com/mcpplibs/os/archive/refs/tags/${tag}.tar.gz",
24+
},
25+
},
26+
2027
xpm = {
2128
linux = {
29+
["0.1.1"] = {
30+
url = "https://github.com/mcpplibs/os/archive/refs/tags/0.1.1.tar.gz",
31+
sha256 = "c5abfb625ded0d5d837b799722c836c302460251d47081fef7a57a2a12e6b2b9",
32+
},
2233
["0.1.0"] = {
2334
url = {
2435
GLOBAL = "https://github.com/mcpplibs/os/archive/refs/tags/0.1.0.tar.gz",
@@ -28,6 +39,10 @@ package = {
2839
},
2940
},
3041
macosx = {
42+
["0.1.1"] = {
43+
url = "https://github.com/mcpplibs/os/archive/refs/tags/0.1.1.tar.gz",
44+
sha256 = "c5abfb625ded0d5d837b799722c836c302460251d47081fef7a57a2a12e6b2b9",
45+
},
3146
["0.1.0"] = {
3247
url = {
3348
GLOBAL = "https://github.com/mcpplibs/os/archive/refs/tags/0.1.0.tar.gz",
@@ -37,6 +52,10 @@ package = {
3752
},
3853
},
3954
windows = {
55+
["0.1.1"] = {
56+
url = "https://github.com/mcpplibs/os/archive/refs/tags/0.1.1.tar.gz",
57+
sha256 = "c5abfb625ded0d5d837b799722c836c302460251d47081fef7a57a2a12e6b2b9",
58+
},
4059
["0.1.0"] = {
4160
url = {
4261
GLOBAL = "https://github.com/mcpplibs/os/archive/refs/tags/0.1.0.tar.gz",

‎tests/examples/os/mcpp.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name = "os-tests"
66
version = "0.1.0"
77

88
[dependencies.mcpplibs]
9-
os = "0.1.0"
9+
os = "0.1.1"
1010

1111
[indices]
1212
mcpplibs = { path = "../../.." }

‎tests/examples/os/tests/os.cpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ int main(int argc, char** argv) {
2121
check(!os::fs::publish(file, "second").has_value(), "a published name is not replaced");
2222
check(os::fs::read(file).value_or("") == "first", "and keeps what was published first");
2323

24+
// 0.1.1: a name the Windows code page cannot spell, both ways (UTF-8 throughout).
25+
const std::string name = "\xE4\xB8\xAD\xE6\x96\x87 \xD0\xBA\xD0\xB8\xD1\x80.txt";
26+
const auto wide = dir / os::fs::from_utf8(name);
27+
check(os::fs::write(wide, "ok").has_value() && os::fs::read(wide).value_or("") == "ok", "a file whose name is not ASCII");
28+
check(os::fs::utf8(wide.filename()) == name, "and its name reads back as UTF-8");
29+
2430
const char sep = os::conventions().path_list_separator;
2531
const auto parts = os::env::split_list(std::string("a") + sep + sep + "b");
2632
check(parts.size() == 2, "a list of directories splits at the host's separator");

0 commit comments

Comments
 (0)