Skip to content

Update path handling for playnite portable case#86

Merged
gantoine merged 7 commits intorommapp:mainfrom
dravorle:main
Feb 1, 2026
Merged

Update path handling for playnite portable case#86
gantoine merged 7 commits intorommapp:mainfrom
dravorle:main

Conversation

@dravorle
Copy link
Copy Markdown
Contributor

Quick Overview

This PR addresses and issue where portable Playnite installations are unable to install roms when their target directory is within the Playnite installation. It also provides the ability to move your installation around without it loosing track of installed files.

Issues

  • The Plugin currently replaces all mentions of the Playnite-Path with "{PlayniteDir}" and stores this as is and never resolves it
  • The installation process tries to write to (literally) "{PlayniteDir}/...", which failes
  • The "IsInstalled" check during library fetching will never work, as it is also checking agains "{PlayniteDir}/..."

Changes

OnApplicationStarted

  • We provide the current application path to the necessary games. This ensures that they always have the up to date locations and are resolved during runtime of playnite

OnApplicationStopped

  • We check for all roms that use the path and change it to the variable so they can be repopulated on the next startup

RomMInstallController

  • Remove Path Replacement as we can now assume that paths are correctly mapped during runtime

GetGames

  • We remove the path replacement, this fixes the "IsInstalled" lookup
  • additionally I added the "CoverImage" to the GameMetadata, this ensures the image provided by RomM will be used as the playnite image, preventing refetching from metadata providers

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @dravorle, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the robustness and portability of Playnite installations by introducing a sophisticated path management system. It resolves critical issues where portable installations failed to correctly track or install ROMs when located within the Playnite directory. By dynamically expanding and collapsing "{PlayniteDir}" variables at runtime, the changes ensure that game and ROM paths remain valid even if the Playnite installation is moved. Furthermore, it streamlines the game metadata retrieval process by directly incorporating cover images.

Highlights

  • Portable Playnite Path Resolution: Implemented dynamic resolution of the "{PlayniteDir}" variable in game and ROM installation paths during application startup for portable Playnite installations, ensuring correct paths are used at runtime.
  • Portable Playnite Path Reversion: Added logic to revert resolved paths back to the "{PlayniteDir}" variable upon application shutdown, enabling seamless movement of portable Playnite installations without losing track of installed files.
  • Installation Path Handling Simplification: Removed redundant path replacement logic from the installation controller, as path resolution is now handled dynamically at the application level.
  • IsInstalled Check Fix: Corrected the "IsInstalled" lookup for ROMs by removing an incorrect path replacement during game metadata retrieval, ensuring accurate installation status.
  • Cover Image Integration: Enhanced GameMetadata to include CoverImage directly from RomM, optimizing image loading and preventing unnecessary metadata lookups from external providers.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to improve path handling for portable Playnite installations and updates the "Newtonsoft.Json" dependency to a more secure version. While it introduces architectural improvements and enhances "CoverImage" metadata handling, there are critical security and stability concerns. An unaddressed path traversal vulnerability in the game metadata fetching logic could allow arbitrary file writes. Furthermore, the new path expansion logic in "OnApplicationStarted" and "OnApplicationStopped" lacks crucial null checks for "game.Roms" and "game.InstallDirectory", potentially causing crashes, and the "string.Replace" operation in "OnApplicationStopped" needs a more precise check to prevent incorrect path modifications.

@dravorle dravorle marked this pull request as draft January 31, 2026 06:10
@dravorle dravorle marked this pull request as ready for review January 31, 2026 06:23
@gantoine gantoine merged commit 28802cd into rommapp:main Feb 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants