From aa3a5fa0a10b7ecf2a3aedc669c58b016bfd21ad Mon Sep 17 00:00:00 2001 From: Jon Ludlam Date: Mon, 7 Jul 2025 11:41:07 +0000 Subject: [PATCH 1/2] fs_fake: implement rename --- runtime/js/fs_fake.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/runtime/js/fs_fake.js b/runtime/js/fs_fake.js index 8c55bb7488..ee50676c6b 100644 --- a/runtime/js/fs_fake.js +++ b/runtime/js/fs_fake.js @@ -81,6 +81,17 @@ class MlFakeDevice { } } + rename(oldname, newname) { + if (this.exists(newname)) + caml_raise_sys_error(this.nm(newname) + " : file already exists"); + if (!this.exists(oldname)) + caml_raise_sys_error(this.nm(oldname) + " : no such file or directory"); + if (this.is_dir(oldname)) + caml_raise_sys_error(this.nm(oldname) + " : not a file"); + this.content[newname] = this.content[oldname]; + delete this.content[oldname]; + } + mkdir(name, _mode, raise_unix) { if (this.exists(name)) caml_raise_system_error( From e1ca220af261b168fa6fe52ffd7e7913c15ada50 Mon Sep 17 00:00:00 2001 From: Jon Ludlam Date: Tue, 15 Jul 2025 18:00:42 +0100 Subject: [PATCH 2/2] CHANGES --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 3490684715..f5e6ee00d9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ ## Features/Changes * Compiler: exit-loop-early in more cases (#2077) +* Runtime: support rename in fake filesystem (#2080) # 6.1.1 (2025-07-07) - Lille