WeiDUorg / weidu

WeiDU is a program used to develop, distribute and install modifications for games based on the Infinity Engine.
http://www.weidu.org
GNU General Public License v2.0
90 stars 20 forks source link

COPY_EXISTING/COPY_EXISTING_REGEXP should not fail for resources with empty filenames #183

Closed Argent77 closed 3 years ago

Argent77 commented 3 years ago

COPY_EXISTING and COPY_EXISTING_REGEXP fail with an error for biffed resources with empty filenames (e.g. .BCS). This issue can occur in the current PST:EE version (v3.1.4.0) which contains a biffed script file with empty filename.

Example:

COPY_EXISTING_REGEXP ~.*\.BCS~ ~override~
  // doing stuff...
BUT_ONLY

Resulting error:

ERROR locating resource for 'COPY'
Resource [.BCS.] not found in KEY file:
    [./chitin.key]
Stopping installation because of error.

This issue exists since WeiDU v247.

FredrikLindgren commented 3 years ago

I'll have a look. It's possible something has changed in OCaml's libraries. There's that spurious period after BCS that seems like the bits that take apart the file name are not doing it right.

FredrikLindgren commented 3 years ago

Note to self: this happens because no part of Util.split can handle "dot files"; it's exceptions throughout. Maybe implement a dedicated function for splitting resrefs, since the reduced scope allows for making some assumptions.

FredrikLindgren commented 3 years ago

Fixed in ade8c4d7a05849f1c8e9a50bac0a83c6bf644498.