Skip to content

feat: add IO.FS.rename - #2345

Merged
Kha merged 1 commit into
leanprover:masterfrom
digama0:fs_rename
Jul 22, 2023
Merged

Kha merged 1 commit into
leanprover:masterfrom
digama0:fs_rename

Conversation

@digama0

@digama0 digama0 commented Jul 22, 2023

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread src/Init/System/IO.lean Outdated
@[extern "lean_io_remove_dir"] opaque removeDir : @& FilePath → IO Unit
@[extern "lean_io_create_dir"] opaque createDir : @& FilePath → IO Unit

@[extern "lean_io_rename"] opaque rename : @& FilePath → @& FilePath → IO Unit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add parameter names and a docstring

Comment thread src/runtime/io.cpp Resolved
@Kha Kha added the awaiting-author Waiting for PR author to address issues label Jul 22, 2023
@Kha Kha self-assigned this Jul 22, 2023
@digama0
digama0 requested a review from Kha July 22, 2023 20:24
@Kha
Kha enabled auto-merge (rebase) July 22, 2023 20:54
@Kha

Kha commented Jul 22, 2023

Copy link
Copy Markdown
Member

Thanks!

@Kha
Kha merged commit dd313c6 into leanprover:master Jul 22, 2023
@tydeu tydeu removed the awaiting-author Waiting for PR author to address issues label Jul 27, 2023
bors Bot pushed a commit to leanprover-community/mathlib4 that referenced this pull request Aug 2, 2023
…v program (#6284)

The Cache program after detecting that LeanTar is old downloads it and attempts to place it in the `CACHEDIR` directory. It then attempts to rename it using the `mv` command it assumes is present on the platform. On windows `cmd` and `powershell` this does not work since `mv` is actually a shell built in and not an executable. (This will however work on MinGW based shells).

@digama0 added the function `IO.FS.rename` in Lean [Lean4#2345](leanprover/lean4#2345 (comment)) which calls the standard C/C++ function `rename`. This PR uses this function to move leantar instead of the runCmd command. When this fix succeeds the output looks like the following (in powershell).

```text
PS W:\LeanStuff\graveyard_mathlib4\LeanCacheFix> lake exe cache get
leantar is too old; downloading more recent version
Attempting to download 3614 file(s)
Downloaded: 3614 file(s) [attempted 3614/3614 = 100%] (100% success)
Decompressing 3614 file(s)
unpacked in 323 ms
```



Co-authored-by: Mario Carneiro <[email protected]>
kim-em pushed a commit to leanprover-community/mathlib4 that referenced this pull request Aug 3, 2023
…v program (#6284)

The Cache program after detecting that LeanTar is old downloads it and attempts to place it in the `CACHEDIR` directory. It then attempts to rename it using the `mv` command it assumes is present on the platform. On windows `cmd` and `powershell` this does not work since `mv` is actually a shell built in and not an executable. (This will however work on MinGW based shells).

@digama0 added the function `IO.FS.rename` in Lean [Lean4#2345](leanprover/lean4#2345 (comment)) which calls the standard C/C++ function `rename`. This PR uses this function to move leantar instead of the runCmd command. When this fix succeeds the output looks like the following (in powershell).

```text
PS W:\LeanStuff\graveyard_mathlib4\LeanCacheFix> lake exe cache get
leantar is too old; downloading more recent version
Attempting to download 3614 file(s)
Downloaded: 3614 file(s) [attempted 3614/3614 = 100%] (100% success)
Decompressing 3614 file(s)
unpacked in 323 ms
```



Co-authored-by: Mario Carneiro <[email protected]>
kim-em pushed a commit to leanprover-community/mathlib4 that referenced this pull request Aug 3, 2023
…v program (#6284)

The Cache program after detecting that LeanTar is old downloads it and attempts to place it in the `CACHEDIR` directory. It then attempts to rename it using the `mv` command it assumes is present on the platform. On windows `cmd` and `powershell` this does not work since `mv` is actually a shell built in and not an executable. (This will however work on MinGW based shells).

@digama0 added the function `IO.FS.rename` in Lean [Lean4#2345](leanprover/lean4#2345 (comment)) which calls the standard C/C++ function `rename`. This PR uses this function to move leantar instead of the runCmd command. When this fix succeeds the output looks like the following (in powershell).

```text
PS W:\LeanStuff\graveyard_mathlib4\LeanCacheFix> lake exe cache get
leantar is too old; downloading more recent version
Attempting to download 3614 file(s)
Downloaded: 3614 file(s) [attempted 3614/3614 = 100%] (100% success)
Decompressing 3614 file(s)
unpacked in 323 ms
```



Co-authored-by: Mario Carneiro <[email protected]>
kim-em pushed a commit to leanprover-community/mathlib4 that referenced this pull request Aug 14, 2023
…v program (#6284)

The Cache program after detecting that LeanTar is old downloads it and attempts to place it in the `CACHEDIR` directory. It then attempts to rename it using the `mv` command it assumes is present on the platform. On windows `cmd` and `powershell` this does not work since `mv` is actually a shell built in and not an executable. (This will however work on MinGW based shells).

@digama0 added the function `IO.FS.rename` in Lean [Lean4#2345](leanprover/lean4#2345 (comment)) which calls the standard C/C++ function `rename`. This PR uses this function to move leantar instead of the runCmd command. When this fix succeeds the output looks like the following (in powershell).

```text
PS W:\LeanStuff\graveyard_mathlib4\LeanCacheFix> lake exe cache get
leantar is too old; downloading more recent version
Attempting to download 3614 file(s)
Downloaded: 3614 file(s) [attempted 3614/3614 = 100%] (100% success)
Decompressing 3614 file(s)
unpacked in 323 ms
```



Co-authored-by: Mario Carneiro <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants