LuxenDM / fpxcmd

FATE Patcher Core deployment module
Other
1 stars 0 forks source link

FPX fails with "Permission Denied" on deploy operations if game path is fixed #15

Closed LuxenDM closed 4 months ago

LuxenDM commented 4 months ago

Per Cristi80's issue on NexusMods, FPX is failing to copy files during deployment if the FateLocation in config is a static non-relative path. The error states like this:

Sun May 12 22:23:11 2024 [INFO] PATCH NAME_PREFIX_IT Sun May 12 22:23:11 2024 [ERROR] Unable to create folder: X:\Software Library\GOG Galaxy\Games\FATE\NAMES\it from file X:\Software Library\GOG Galaxy\Games\FATE\NAMES\it\prefix.dat Error: Permission denied

This is a bug within the code that creates and/or tests for the completeness of a directory, probably. It has been tested locally, and occurs regardless of market platform. It is not an admin-auth issue.

LuxenDM commented 4 months ago

The bug has been identified in function createDirectories(). This function breaks a provided path into its members and attempts to create them sequentially. This is done because LFS (the lua module that provides advanced directory and file access to this application) doesn't allow for creating an entire directory tree.

When the provided path is relative (e.g. starts with a .\ representing the fate directory), the error would be 'file exists', which is already caught as it is expected. However, when the provided path is a static directory (which typically start with a drive letter), this function attempts to "Create" the drive letter, which (obviously) results in a 'permission denied' error, which isn't caught.

A fix has been implemented; createDirectories() now checks if the provided path starts with a drive letter. if it does, it skips that drive letter in the process that builds a folder tree. This appears to have fixed the issue completely. The fixed version will be compiled and uploaded shortly.

The fix has been added in commit c735e4621453acaa356fa29b4b7fc0175987c3ed