Gemba / skyscraper

Powerful and versatile game data scraper written in Qt and C++.
https://gemba.github.io/skyscraper/
GNU General Public License v3.0
55 stars 14 forks source link

No longer able to use symlinks to roms #38

Closed abuchanan920 closed 9 months ago

abuchanan920 commented 9 months ago

Describe the bug I have my roms on a samba share and mounted to my arcade machine at /mnt/Emulation/MAME. Under that I have various subdirectories for roms for different mame versions, such as /mnt/Emulation/MAME/mame-2010.

In my /home/pi/RetroPie/roms/arcade directory, I have symlinks to the appropriate roms, such as: /home/pi/RetroPie/roms/arcade/romfile.zip -> /mnt/Emulation/MAME/mame-2010/romfile.zip

This used to work just fine and would result in the gamefile.xml file having a path to the rom as /home/pi/RetroPie/roms/arcade/romfile.zip (the location of the symlink) but now has /mnt/Emulation/MAME/mame-2013/romfile.zip (the target of the symlink) along with some odd directories at the bottom of the file such as:

    <folder>
        <path>./../../../../../mnt/Emulation/MAME/target-mame2003-plus</path>
        <name>target-mame2003-plus</name>
    </folder>
    <folder>
        <path>./../../../../../mnt/Emulation/MAME</path>
        <name>MAME</name>
    </folder>
    <folder>
        <path>./../../../../../mnt/Emulation</path>
        <name>Emulation</name>
    </folder>
    <folder>
        <path>./../../../../../mnt</path>
        <name>mnt</name>
    </folder>
    <folder>
        <path>./../../../../..</path>
        <name>..</name>
    </folder>
    <folder>
        <path>./../../../..</path>
        <name>..</name>
    </folder>
    <folder>
        <path>./../../..</path>
        <name>..</name>
    </folder>
    <folder>
        <path>./../..</path>
        <name>..</name>
    </folder>
    <folder>
        <path>./..</path>
        <name>..</name>
    </folder>
    <folder>
        <path>./../../../../../mnt/Emulation/MAME/target-mame2010</path>
        <name>target-mame2010</name>
    </folder>
    <folder>
        <path>./../../../../../mnt/Emulation/MAME/target-fbneo</path>
        <name>target-fbneo</name>
    </folder>
    <folder>
        <path>./../../../../../mnt/Emulation/MAME/target-mame2016</path>
        <name>target-mame2016</name>
    </folder>
    <folder>
        <path>./../../../../../mnt/Emulation/MAME/target-078</path>
        <name>>target-078</name>
    </folder>

This results in emulationstation not working properly and giving a ton of errors that look like:

Feb 23 01:47:43 lvl0:   File path "/mnt/Emulation/MAME/target-mame2003-plus/sonicwi2.zip" is outside system path "/home/pi/RetroPie/roms/arcade"
Feb 23 01:47:43 lvl0:   Error finding/creating FileData for "/mnt/Emulation/MAME/target-mame2003-plus/sonicwi2.zip", skipping.

It seems that https://github.com/Gemba/skyscraper/commit/4aff22586d848f9974d2464d5372b8986a0e64c0 is the root cause. Probably the change from using the absolute path to the canonical path around line 180 in the new file.

To Reproduce See above

Expected behavior The path to the symlink should be what is reflected in gamelist.xml file, not the target of the symlink which will break emulationstation.

Special circumstances Described above

Terminal output [Replace this text with any useful Skyscraper terminal output that might help clarify your issue. For longer output use pastebin.com, ix.io or similiar.]

Technical information

Additional context [Replace this text with any additional context that might help understand this issue better. Optional.]

Gemba commented 9 months ago

Thanks for the detailed report and PR. Valid claim.

I assume it is ok for you if the relative path would be canonical (everything right of the caret below)? e.g:

/home/pi/RetroPie/roms/<platform>/<symlink-inside-of-platform>/rom.zip # --> would be absolute: path/to/rom.zip
---------------------------------^

I remember having some trouble when the inputDir is not canonical, but I am pretty sure to be able to use the absolute path for the gamelist creation. Leave it with me.

abuchanan920 commented 9 months ago

I think so, yes

Gemba commented 9 months ago

I followed your reverting, and remembered why I did change it in the first place. Thus I addressed also the corner-case I noticed. Can you build from https://github.com/Gemba/skyscraper/tree/fix_issue_38 and test if it is ok also on your side?