0

I have a cross-platform (macOS-Windows) "slideshow" type app built in Electron which works fine with files and media assets from a local drive but fails with UNC paths and "mapped network drives". Compounding the issue is, as a contractor, I don't have access to that sort of networked computing environment to debug this issue.

A recent comment from the IT person at a customer's office:

we noticed that when trying to open project files using a UNC path (i.e. \\servername\share1\presenter ) it doesn’t show images, but when we mapped a drive (i.e. z:\ drive) and pointed to the same location the images loaded as expected. Is this a known issue?

I've searched around but haven't seen any clear solutions for handling loading files and reading/writing to JSON files stored on a networked drive. Worse, I don't really understand the tech issues involved. Can anyone help?

Details: Through Electron dialogs, a user is able to create or open a "project" and select media assets to be copied into the project. A project consists of a directory containing aJSON file and these media assets. The JSON file references the assets using paths relative to the project folder (e.g. "filePath": "assets/images/500x500.png"). To load an asset I use upath and join the project path with the relative asset path:

upath.toUnix(upath.join(projectDirectory, d.eventMedia.imageList[i].filePath)) 

Which would result in something like:

c:/Documents/mySuperProject/assets/images/500x500.png

This has worked pretty well across both macOS and Windows. I don't understand what the fail point is with UNC paths.

Beliaev Maksim
  • 968
  • 12
  • 21
spring
  • 18,009
  • 15
  • 80
  • 160

1 Answers1

0

we use internally electron and I just tested a workflow that we use (user selects an options file and we copy it to app folder) it works fine with UNC paths: looks at example https://github.com/beliaev-maksim/beta_build_downloader/blob/6b5fce4b675cc108e4048e7d65676133df0ef78e/electron_ui/js/settings.js#L115

what I may assume might be an issue, UNC path looks like \\servername\folder with double slash. Thus, worth to check that path is not really truncated as special character

another thing to try just path module on Windows systems

Beliaev Maksim
  • 968
  • 12
  • 21