Search code examples
rakurakudo

move function does not work in Raku in Windows


This is my folder structure:

C:\USERS\SUMAN\OPENMP_CMAKE
│   shlib.pl
│   shlib.raku
│
└───resources
    └───libraries

the shlib.raku contains this line

move "shlib.pl", "resources/libraries"

When I run this script, it cannot move file. Reading the docs here, I expected it to work. Instead it throws this error:

Failed to move 'C:\Users\suman\openmp_cmake\shlib.pl' to 'C:\Users\suman\openmp_cmake\resources\libraries': Failed to copy file: operation not permitted
  in block <unit> at c:\Users\suman\openmp_cmake\shlib.raku line 1

I suppose it is system related. But is there a way to get around this? Because it will help me automate things. This is my system information:

Host Name:                 SUMANKHANAL
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.19043 N/A Build 19043
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation
OS Build Type:             Multiprocessor Free
Registered Owner:          N/A
Registered Organization:   N/A
Product ID:                00331-20350-00000-AA867
Original Install Date:     2/19/2022, 1:41:50 PM
System Boot Time:          4/10/2022, 9:35:07 PM
System Manufacturer:       Dell Inc.
System Model:              Inspiron 5379
System Type:               x64-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: Intel64 Family 6 Model 142 Stepping 10 GenuineIntel ~2001 Mhz
BIOS Version:              Dell Inc. 1.17.0, 8/18/2021
Windows Directory:         C:\WINDOWS
System Directory:          C:\WINDOWS\system32
Boot Device:               \Device\HarddiskVolume1
System Locale:             en-us;English (United States)
Input Locale:              en-us;English (United States)
Time Zone:                 (UTC+05:45) Kathmandu
Total Physical Memory:     8,025 MB
Available Physical Memory: 1,442 MB
Virtual Memory: Max Size:  14,425 MB
Virtual Memory: Available: 3,820 MB
Virtual Memory: In Use:    10,605 MB
Page File Location(s):     C:\pagefile.sys
Domain:                    WORKGROUP
Logon Server:              \\SUMANKHANAL
Hotfix(s):                 7 Hotfix(s) Installed.
                           [01]: KB5010472
                           [02]: KB5012117
                           [03]: KB5000736
                           [04]: KB5012599
                           [05]: KB5011352
                           [06]: KB5011651
                           [07]: KB5005699
Network Card(s):           2 NIC(s) Installed.
                           [01]: Qualcomm QCA61x4A 802.11ac Wireless Adapter
                                 Connection Name: Wi-Fi
                                 DHCP Enabled:    Yes
                                 DHCP Server:     192.168.1.254
                                 IP address(es)
                                 [01]: 192.168.1.83
                                 [02]: fe80::d948:4175:e48d:b886
                                 [03]: 2400:1a00:b111:3e81:c506:663d:5c33:418a
                                 [04]: 2400:1a00:b111:3e81:d948:4175:e48d:b886
                                 [05]: 2400:1a00:b111:3e81::2
                           [02]: Bluetooth Device (Personal Area Network)
                                 Connection Name: Bluetooth Network Connection
                                 Status:          Media disconnected
Hyper-V Requirements:      VM Monitor Mode Extensions: Yes
                           Virtualization Enabled In Firmware: Yes
                           Second Level Address Translation: Yes
                           Data Execution Prevention Available: Yes

In repl.it (Linux) also, I don't see if its working, here is the error:

Failed to move '/home/runner/WrithingCharmingSemicolon/openmp_cmake/shlib.pl' to '/home/runner/WrithingCharmingSemicolon/openmp_cmake/resources/libraries': Failed to copy file: illegal operation on a directory
  in block <unit> at shlib.raku line 1

Solution

  • Apparently, move does not work on directories, that's what the error says if you do more or less the same in Linux

    move "shlib.pl", IO::Path.new("resources/libraries/shlib.pl")
    

    This works in Linux, can you please check if it works in Windows? It does create a path which should be independent of the filesystem conventions, thanks to using IO::Path