Playnite Forums
Using {PlayniteDir} in emulator config fields - Printable Version

+- Playnite Forums (https://playnite.link/forum)
+-- Forum: Playnite (https://playnite.link/forum/forum-1.html)
+--- Forum: Support and Troubleshooting (https://playnite.link/forum/forum-4.html)
+--- Thread: Using {PlayniteDir} in emulator config fields (/thread-956.html)



Using {PlayniteDir} in emulator config fields - whoozwah - 11-12-2021

I would like to make my Playnite install completely portable so that I can use it from a flash drive and have made an emulators folder inside of playnite with subfolders for my emulators. However when I edit the installation path of my emulators to read, for example:

{PlayniteDir}\Emulators\Retroarch

That doesn't work. I get an error that the emulator cannot be found. Is there a way to define emulator exe locations using relative paths?

Edit: I discovered the solution. Instead of using {PlayniteDir} variable, I used a period. So the correct relative path is

.\Emulators\Retroarch

I didn't realize Playnite respects windows relative path arguments as well as it's own internally defined variables. I will leave this thread up for others that may find it useful.


RE: Using {PlayniteDir} in emulator config fields - Crow - 11-13-2021

Looks like a bug, it should be working, I'll look into it. It's just emulator installation folder that didn't work with it?

Using {PlayniteDir} is definitely preferable because .\ will break if something starts Playnite with different working directory.


RE: Using {PlayniteDir} in emulator config fields - Mitsie - 03-07-2022

I use Playnite on a portable Hard drive and use it alongside emulators for portability. It is flawless in every other respect, apart from not being able to use {PlayniteDir} in the emulator auto configurator.
Using .\ works as whoozwah points out in his OP.

But then comes another problem, if you use a standard directory on the drive like C:/Games and not a relative path everything works as intended.

Using static drive paths is fine when not using playnite for portability, as a USB hard drive could be E:/ on one machine, then G:/ on another so will break the library and break the portability.

If you use the relative path .\ when playnite does a library update for the Emulator, it looks at the path and never matches the already existing games, so it duplicates the same games, even if nothing has changed.

The only way around this, for example, if you want to add one game to your collection. You must delete all the games for that platform and then let Playnite find them all again. This can turn a 2 minute library update into a 8 hour job of re-editing all of your titles, artwork and correcting "how long to beat" mismatches etc.

Is there any chance the {PlayniteDir} can be added to work in the emulator auto-configuration tab, or alternatively, playnite to detect already existing games for using a relative path .\ so it doesn't create duplicates of every game on every emulator library update. Either or would be good.

It's great,because I can pick up my portable hard drive and take my massive game collection and library with me.


RE: Using {PlayniteDir} in emulator config fields - Crow - 03-08-2022

{PlayniteDir} and {EmulatorDir} variables not working properly in emulation related fields is being fixed in Pplaynite 10.


RE: Using {PlayniteDir} in emulator config fields - Mitsie - 03-08-2022

(03-08-2022, 07:25 AM)Crow Wrote: {PlayniteDir} and {EmulatorDir} variables not working properly in emulation related fields is being fixed in Pplaynite 10.

Good Stuff..  Big Grin


RE: Using {PlayniteDir} in emulator config fields - Mitsie - 10-20-2022

Hi Just a quick update on this, Im not sure if its an error in the coding, I can now use {PlayniteDir} or {EmulatorDir} as well as .\ in the emulator auto scan configuration fields, but when I rescan the Emulator, it doesn't detect the already existing games and ignore the update.

Im guessing for example the script is finding the autoconfiguration field as:
{PlayniteDir}\..\Roms\NintendoSwitch\

Then it must compile the full directory to update the games e.g:
E:\Roms\NintendoSwitch\

Then tries to match the two directories and doesn't find a match

if( "{PlayniteDir}\..\Roms\NintendoSwitch\" == "E:\Roms\NintendoSwitch\" ){
// skips adding this game to the library as it already exists
return;
}

So it is doing a false match. as when it uses full directory paths it finds a match and skips the game and doesn't create duplicate games for the system:

So if I set the full directory In the auto-configuration "Scan Folder":
E:\Roms\NintendoSwitch\

When I run another auto scan because Ive added one new game, it skips all the duplicates and just adds the one new game, so I'm guessing its running something like this:

if( "E:\Roms\NintendoSwitch\" == "E:\Roms\NintendoSwitch\" ){
// skips adding this game to the library as it already exists
return;
}

This would match TRUE as the two fields are the same and skip the duplicates.

I've obviously replaced the variables with the full fields for example purposes.

It is only a guess of what is happening, but that seems to be what is happening in the background in my opinion.


RE: Using {PlayniteDir} in emulator config fields - Crow - 10-23-2022

I'll look into it.


RE: Using {PlayniteDir} in emulator config fields - Crow - 10-24-2022

What is the exact use case for you? {PlayniteDir} or {EmulatorDir} is currently not supported in scan configurations so I have no idea how are you actually reproducing this issues. Please provide exact examples of paths assigned to actual games, emulator config and scan config.