-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve virtualized paths on Windows #112
Comments
Thanks for the report. A similar issue was raised on this subject. I think I understand the problem but I'm not sure where it fails. Can you clarify with a specific example ? Are you trying to run an .exe file, are you using an absolute path in the executable (preferred, could be get using `normalize(absolute(executable)) ? |
@alextekartik I'm shipping the app with a ffmpeg.exe executable that I am copying in the application support directory and trying to run it to process videos loaded by the user. I've tried running both with an absolute path and a relative one. For the relative path, I need to set the correct working directory but I don't know how to get the real path in the system. The |
So multiple paths are involved:
process_run uses Is it an issue in finding the path to the files that you send as arguments to ffmpeg ? Or finding a valid working path ? What is the best way to reproduce the issue during development ? |
The paths that I'm not sure you can reproduce during dev. I only discovered the issue after publishing the app to Microsoft Store. As I mentioned before, Windows installs the app in a different place in the file system but reports virtualized paths to the app. Doing File operations works with these virtualized paths. They don't work however with I'm wondering if it's a permission thing. Does process_run work in a separate isolate or a completely separate process? |
It uses io Process and runs in the main thread but spawn a separate child process (and asynchronously wait for its end)
That's my fear too. If you have an opportunity to try a simple command such as |
@alextekartik I managed to make the shell commands to work by manually modifying the paths from the virtualized ones to the real ones. It's a hack and I'm not confident it will work on all Windows computers but it's the best I could come up with. The basic gist is the following: If a path starts with This works for msix files installed from Microsoft Store but not if I run the app from an IDE or install the app as a standalone one outside of MS Store. In this case the paths should be left alone and not be modified. |
getApplicationSupportDirectory()
from path_provider plugin returns a path such asC:\Users\John\AppData\Roaming\CompanyName\AppName
and it works fine to save and read files using dart:io.However, I see that the actual location for this directory is at a path such as
C:\Users\John\AppData\Local\Packages\CompanyAppNameHash\LocalCache\Roaming\CompanyName\AppName
So it seems there is some abstraction/translation of paths being done by Windows OS. I understand it's called virtualization.
The issue I am running into is that I want to run an in-app executable and I need the actual real paths in order to run it. It seems that
Shell
andProcess.run
does not do the abstraction/translation part that happens when using dart:io and so the commands fail by not resolving the supplied paths.I don't see any way to get the real paths to use in the shell commands so I'm thinking that maybe the plugin can do the path abstraction/translation similarly to how the dart:io package seems to be doing.
The text was updated successfully, but these errors were encountered: