mkroening / edu-sync

A command line application for synchronizing the contents of Moodle instances to your computer.
GNU General Public License v3.0
22 stars 0 forks source link

Error on Windows: "system cannot find the path specified. (os error 3)" #8

Open asclepiadae opened 2 months ago

asclepiadae commented 2 months ago

Downloaded the Windows compiled binary, and tried running it. The binary is located in the folder that I am looking to download the Moodle data to. The path is nice and short: C:\Users\usern\Moodle

I am using the following in PowerShell and CMD as the first part of the full command as I have a token: .\edu-sync-cli add https://moodle.domain.tld path

I have tried the following as the entry for the path:

\
/
~
~\
.
C:\Users\usern\Moodle
C:/Users/usern/Moodle
"C:\Users\usern\Moodle"
'C:\Users\usern\Moodle'
download
\download
C:\Users\usern\Moodle\download
C:\Moodle\
C:\Moodle

Note that the folders C:\Users\usern\Moodle\download and C:\Moodle do not actually exist, just in case the utility needed a path to create a directory.

For every single attempt I get: Error: The system cannot find the path specified. (os error 3)

If I run .\edu-sync-cli config I get a very nice returned line: C:\Users\usern\AppData\Roaming\Edu Sync\Edu Sync\config\Edu Sync\Edu Sync.toml

I just don't understand why that format doesn't seem to be a valid entry for the download-to path!

asclepiadae commented 2 months ago

AH! Progress has been made...

So it seems like the issue is actually with the config path! Running .\edu-sync-cli config returned C:\Users\usern\AppData\Roaming\Edu Sync\Edu Sync\config\Edu Sync\Edu Sync.toml but that full tree and file did not exist. The directory tree did exist up to this point: C:\Users\usern\AppData\Roaming\Edu Sync\Edu Sync\config

Creating the final \Edu Sync\ directory and then leaving it empty to allow the Edu Sync.toml file to be created solved the issue and accepted a normal Windows directory path!

asclepiadae commented 2 months ago

Aaaaand part three... I think I have narrowed down the issue, and it's affecting more than just the initial run but the actual sync process.

I believe it has to do with the limitations Windows has on path lengths, which is apparently still a problem...

After the sync completes and gets most files, there are 182 items that are left unsynced. The tasks panic and produce toml report files like the following:

name = "edu-sync-cli"
operating_system = "Windows 10.0.22635 (Windows 11 Professional) [64-bit]"
crate_version = "0.2.2"
explanation = '''
Panic occurred in file 'edu-sync-cli\src\sync.rs' at line 492
'''
cause = 'called `Result::unwrap()` on an `Err` value: Os { code: 3, kind: NotFound, message: "The system cannot find the path specified." }'
method = "Panic"
backtrace = """

   0: 0x7ff77d3d41e6 - <unresolved>
   1: 0x7ff77d4ab517 - <unresolved>
   2: 0x7ff77d4ab9d3 - <unresolved>
   3: 0x7ff77d088a89 - <unresolved>
   4: 0x7ff77d076b0d - <unresolved>
   5: 0x7ff77d097bc8 - <unresolved>
   6: 0x7ff77d3ebcbd - <unresolved>
   7: 0x7ff77d3ea46a - <unresolved>
   8: 0x7ff77d3eead3 - <unresolved>
   9: 0x7ff77d3e4ea4 - <unresolved>
  10: 0x7ff77d406406 - <unresolved>
  11: 0x7ff77d3de39f - <unresolved>
  12: 0x7ff77d401f3a - <unresolved>
  13: 0x7ff77d403c6e - <unresolved>
  14: 0x7ff77d404b42 - <unresolved>
  15: 0x7ff77d3d7b2c - <unresolved>
  16: 0x7fff2946257d - BaseThreadInitThunk
  17: 0x7fff29baaf28 - RtlUserThreadStart"""

I haven't done a full comparison of the many many report files, but it does look like it's some sort of crash due to Windows path issues. Yaaaaaay.