Hi everyone,
I am working on fixing an annoying bug for the ZotMoov plugin, namely that on Windows the IOUtils.move() function fails for any path with a length of over 260 characters. It doesn't throw an error, it simply fails to function, so it was a pain to even find out the cause.
I know this is the default length limit for Windows... However, on my machine I enabled Long Paths AND I am not even moving to a Windows system, but to my Synology NAS DS423, which is on a Linux OS, thus supporting up to 4k characters.
I am looking for a way to either:
A) Configure IOUtils/Zotero to respect this custom path length limit
B) An alternative to this function to achieve what we want.
For context, here is the line that needs to work:
```js
await IOUtils.copy(file_path, final_path, { noOverwrite: true });
```
This is my current quick fix, but it's hacky and not robust... Let alone ideal:
```js
// Temporary fix for file path issue
if (final_path.length > 260) {
this.zotmoov_debugger.error("File path too long: " + final_path + "\nTotal " + (final_path.length) + " characters");
this.zotmoov_debugger.debug("Implementing temporary fix; renaming file to paper.pdf");
const original_file_name = PathUtils.filename(file_path);
const new_file_name = 'paper.pdf';
final_path = final_path.replace(original_file_name, new_file_name);
if (final_path.length > 260) {
this.zotmoov_debugger.error("File path too long after temporary fix: " + final_path + "\nTotal " + (final_path.length) + " characters\nSKIPPING!");
return;
}
this.zotmoov_debugger.debug("Final path: " + final_path);
}
```
Warm regards,
Mr. Hoorn