Skip to content
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

Can't open plugins folder when running EDMC under other user #1113

Closed
norohind opened this issue May 26, 2021 · 7 comments
Closed

Can't open plugins folder when running EDMC under other user #1113

norohind opened this issue May 26, 2021 · 7 comments

Comments

@norohind
Copy link
Contributor

Please complete the following information:

  • Version 5.0.2+a04a31d
  • Game Version: Live
  • OS: Windows 10
  • OS Locale: Russian
  • Browser chrome
  • Please attach BOTH log files, by dragging and dropping them into this input:

EDMarketConnector.log
EDMarketConnector-debug.log

Describe the bug
Getting an error when running EDMC under other user (via runas) and trying press Open button in File -> Settings -> Plugins

To Reproduce

  1. Run EDMC under other user
  2. Go to File -> Settings -> Plugins and find Open button.
  3. Press Open button
  4. See error

Expected behavior
EDMC says to me that it can't open this folder for me
Or
EDMC open this folder

Screenshots
Screenshot of the error
image

Additional context
I use runas /savecread /user:Computer_2 "C:\Program Files (x86)\EDMarketConnector\EDMarketConnector.exe --suppress-dupe-process-popup --force-localserver-for-auth" for run EDMC under other user.

@norohind norohind added bug unconfirmed An unconfirmed bug labels May 26, 2021
@Athanasius
Copy link
Contributor

Probably the easiest work around for this is to give permissions on the other user's files to the main user you run as. After all you're only doing this for the user separation so as to keep Journal files separate, right ?

@Athanasius
Copy link
Contributor

Except now I test this myself:

  1. I can get to the other user's plugins folder without issue using Windows File Explorer.
  2. Yet, indeed, trying to open it from the runas'd EDMarketConnector.exe yields the error as seen above.

We use webbrowser.open(f'file:///{plugdir.get()}') to perform this. So if Windows is doing something weird with that 🤷 I'm not sure what we could do to work around the issue.

As this is 'only' looking at the plugins folder I'm tempted to say "just do that via other means". The selection of Journal folder in the Configuration tab does work under these circumstances.

@Athanasius
Copy link
Contributor

Ah, wait ... maybe this is because we have a relative path to plugins? That will be working for actual file accesses, but maybe in this scenario it ends up as the runas user trying to access the session user's files ?

@Athanasius
Copy link
Contributor

Ah, this might be a case of the string version for the UI being misleading. We do set config.plugin_dir_path to the full path of the user application directory with the appname appended.

So this might just be that the webbrowser.open() bit needs changing to use the full path, not the string version ? What I'm blathering about is that the Settings > Plugins tab shows is AppData\Local\EDMarketConnector\plugins, as that's what's set into the Tk string variable, and we use the Tk string variable in that webbrowser call.

So this might be as simple as just using config.plugin_dir_path in that webbrowser call.

I'll take a look tomorrow.

@Athanasius Athanasius added this to the 5.1.0 milestone May 27, 2021
@Athanasius Athanasius added OS Issue won't fix and removed unconfirmed An unconfirmed bug labels May 27, 2021
@Athanasius
Copy link
Contributor

Upon further investigation our code is (mostly) fine.

  1. I can re-create the issue with runas
  2. But if I actually login to that other user it works perfectly fine.

Ergo this is something to do with webbrowser.open() and/or Windows itself causing different behaviour under runas. I'm not inclined to investigate this very niche case any further, so I'll be marking this as "OS Issue" and "won't fix".

I'll document it in Known Issues/Troubleshooting, probably with some advice to just go find the folder manually.

@Athanasius
Copy link
Contributor

Note that this:

    def __plugin_dir_open(self) -> None:
        # When running from a 'runas' command the simply webbrowser.open() fails
        # on Windows.
        if platform == 'win32':
            os.system(f'explorer.exe {config.plugin_dir_path}')

        else:
            webbrowser.open(f'file:///{config.plugin_dir_path}')

Does NOT solve the issue. When not runas (but from installed .exe) this works as well as the webbrowser.open() version (excepting that you'll briefly see what looks like a cmd.exe window appear and disappear before the explorer.exe window opens). Under runas you get the cmd.exe flicker, but no explorer.exe window. So definitely an OS Issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants