lVlyke / starfield-mod-loader

A cross-platform mod manager for Starfield and other games.
GNU General Public License v3.0
27 stars 1 forks source link

Mod import failed: Error: ENOENT: no such file or directory #14

Closed Alkali-V2 closed 3 months ago

Alkali-V2 commented 3 months ago

Seeing the below error when attempting to import either of these two mods into version 0.7.2 of Starfield Mod Loader:

15:08:02.842 › Mod import failed: Error: ENOENT: no such file or directory, lstat 'profiles/Starfield_Mods/_tmp/Baka Achievement Enabler-658-3-0-0-1718068164/Data/SFSE/Plugins/BakaAchievementEnabler.dll' at lstatSync (node:fs:1668:3) at Object.<anonymous> (node:electron/js2c/asar_bundle:2:4026) at Object.lstatSync (/opt/starfield-mod-loader-bin/resources/app/node_modules/graceful-fs/polyfills.js:319:16) at ElectronLoader.completeModImport (/opt/starfield-mod-loader-bin/resources/app/electron.js:1332:29) at /opt/starfield-mod-loader-bin/resources/app/electron.js:384:25 at WebContents.<anonymous> (node:electron/js2c/browser_init:2:88656) at WebContents.emit (node:events:514:28) Error occurred in handler for 'profile:completeModImport': Error: ENOENT: no such file or directory, lstat 'profiles/Starfield_Mods/_tmp/Baka Achievement Enabler-658-3-0-0-1718068164/Data/SFSE/Plugins/BakaAchievementEnabler.dll' at lstatSync (node:fs:1668:3) at Object.<anonymous> (node:electron/js2c/asar_bundle:2:4026) at Object.lstatSync (/opt/starfield-mod-loader-bin/resources/app/node_modules/graceful-fs/polyfills.js:319:16) at ElectronLoader.completeModImport (/opt/starfield-mod-loader-bin/resources/app/electron.js:1332:29) at /opt/starfield-mod-loader-bin/resources/app/electron.js:384:25 at WebContents.<anonymous> (node:electron/js2c/browser_init:2:88656) at WebContents.emit (node:events:514:28) { errno: -2, syscall: 'lstat', code: 'ENOENT', path: 'profiles/Starfield_Mods/_tmp/Baka Achievement Enabler-658-3-0-0-1718068164/Data/SFSE/Plugins/BakaAchievementEnabler.dll' }

Other mods installed without issue, I noted he switched from his 7z archive to a zip format so I attempted to extract and 7zip it but it did not succeed. I also tried editing the directory (SFSE/Plugins/Achievement.dll) but creating this directory manually did not correct it. Paths should be good but I am providing them here just in case.

image

If you need any other info let me know and I can provide it. Thanks!

OS: Arch Linux CPU: Ryzen 5800X3D Game Platform: Steam Devices: GPU0: apiVersion = 1.3.278 driverVersion = 24.1.1 vendorID = 0x1002 deviceID = 0x744c deviceType = PHYSICAL_DEVICE_TYPE_DISCRETE_GPU deviceName = AMD Radeon RX 7900 XTX (RADV NAVI31) driverID = DRIVER_ID_MESA_RADV driverName = radv driverInfo = Mesa 24.1.1-arch1.1 conformanceVersion = 1.3.0.0 deviceUUID = 00000000-0900-0000-0000-000000000000 driverUUID = 414d442d-4d45-5341-2d44-525600000000

lVlyke commented 3 months ago

Thanks for the bug report.

I’m also able to reproduce this issue on Linux, and after some digging, it appears that the zip files for these mods are using backslashes for path separators instead of slashes, which causes issues when extracting the files on Linux (and is also invalid according to the .ZIP file spec):

      4.4.17.1 The name of the file, with optional relative path.
       The path stored MUST NOT contain a drive or
       device letter, or a leading slash.  All slashes
       MUST be forward slashes '/' as opposed to
       backwards slashes '\' for compatibility with Amiga
       and UNIX file systems etc.  If input came from standard
       input, there is no file name field. 

Most filesystems on Linux use forward slashes for path separators and allow backslashes as part of the file name. When these zip files are extracted on Linux, the backslashes are interpreted as part of the file name, resulting in a file being created with the path as part of the file name itself (i.e. Data\SFSE\Plugins\BakaAchievementEnabler.dll). You can see the issue here when opening one of the zips with an archive utility like File Roller, where it shows a file with the backslash’d path as part of the file name:

Screenshot 2024-06-27 215307

Unfortunately, there’s not much I can do on my side for this issue. I could try to code in a workaround to detect this case and try to fix the folder structure on the fly, but it would be messy platform-specific code that could cause other issues, so I would rather avoid it, especially since this seems to be a pretty rare issue.

I would let the author of these mods know about the issue. Hopefully they can correct the problem with the tool they’re using to generate these zip files to make sure they are created with forward slashes.

As a workaround until then, you should be able to extract the files manually and then create the correct folder structure and fix the file names. You can then import the corrected files directly into the mod loader. Alternatively, if you have access to a Windows machine, you could extract the files on it first and then copy them over to import into the mod loader.

Alkali-V2 commented 3 months ago

A simple fix is good enough for me. I was able to extract the items, create valid directories and get it imported correctly so that is all I needed. Not sure why he made the directory like that but for now I'll use the workaround. Thank you for confirming it wasn't just on my side and for your help getting this sorted out!