ThePortalWiki / PatchDiff

Resources to generate diffs for patches for various Valve video games.
1 stars 0 forks source link

Doesn't work when filepaths exceed 260 characters #1

Closed Blasz closed 11 years ago

Blasz commented 11 years ago

This doesn't work on windows when filepath lengths exceed 260 characters which is definitely possible with extracted vpk filepaths such as

D:\Development\Diffs\raw_files\dota2beta\dota\scaleform_cache_dir.vpk\scaleform_cache\resource\flash3\images\econ\items\lone_druid\true_form\rabid_black_bear\rabid_black_bear_models\items\lone_druid\true_form\rabid_black_bear\rabid_black_bear_large.png_cfg_fb.dds
rjackson commented 11 years ago

I think this is a windows limitation, see Maximum Path Length Limitation; I'm not sure what we can do about it, but I do think we should look for a solution.

Any ideas @Moussekateer @EtiennePerot ?


As a workaround, is it feasible to move your extraction location to the root (or near-root) of your drive? You could shave 26 characters from your example path by doing so, for instance.

I'm also curious as to the maximum length is for the relative paths within the game files. A fair amount of Valve developers work on Windows, so the limitation might very well be something they're taking efforts to stay within also.

EtiennePerot commented 11 years ago

If that's the case, then I wonder how that file got written there in the first place, since I assume it's been extracted by a Windows program using the Windows file API as well. Maybe it's using the \\?\ extended-length paths mentioned in RJ's link, or maybe it's just CD'ing inside the directories it's creating and then using relative filenames when writing files, such that in the end the API calls don't have strings longer than 255 characters. Both of these are things the python script could do, if it helped.

But yeah your first move should be to try and shave some bytes from the start of the string and see if that fixes it, rather than going deeper right away.

Blasz commented 11 years ago

Shortening the extraction location filepath did fix the issue.

The extracted filepath from hlextract.exe was actually less than the max filepath. It was the target location of the resulting copy from the extracted filepath that was longer. The filepath mentioned in the OP was actually the target location of the intended copy. The source location is shown below (less than 260 chars).

D:\Development\Diffs\raw_files\dota2beta\root\scaleform_cache\resource\flash3\images\econ\items\lone_druid\true_form\rabid_black_bear\rabid_black_bear_models\items\lone_druid\true_form\rabid_black_bear\rabid_black_bear_large.png_cfg_fb.dds