rmod8 / GarrysMod-HammerPlusPlus-Installer

MIT License
18 stars 2 forks source link

Data getting put at the very end of gameinfo.txt - missing { #3

Open FlooferLand opened 1 year ago

FlooferLand commented 1 year ago

A little bug i encountered that was pretty easily fixable on my end, but wouldn't be that obvious to anyone who isn't familiar to config files

after installing my gameinfo.txt ended up looking like this:

            // Add the HL2 directory as a game search path.  This is also where where writes
            // to the "game" path go.
            game+game_write     hl2

            // Where the game's binaries are
            gamebin             hl2/bin

            // Last, mount in shared HL2 loose files
            game                |all_source_engine_paths|hl2
            platform            |all_source_engine_paths|platform           
        }
    }
}
            game                "E:\Games\SteamLibrary\steamapps\common\GarrysMod\garrysmod"
            game                "E:\Games\SteamLibrary\steamapps\common\GarrysMod\garrysmod\garrysmod_dir.vpk"
        }
    }

and Hammer complained about missing {

I'm not sure why this issue might be happening, but after looking a bit at the code it does seem to assume some things (expecting specific space characters to go in a specific location) You could likely be able to write a simple parser to find the line where you'd need to paste the game ".. location .." at via the following steps:

  1. Looping trough each line in the file
  2. Stripping/trimming each line so there are no spaces around the words
  3. Skipping the line if it starts with \\, {, or }
  4. Splitting the line at only the very first space _(so you'd get a string array containing game and |all_source_engine_paths|hl2 for example)_
  5. If a line contains game and |all_source_engine_paths|hl2, you could perhaps just paste the custom game things right before that line

Again, not sure how your program works exactly. But hopefully my issue submission helps! Either way i probably could not install Hammer++ for Gmod if it wasn't for this tool

rmod8 commented 1 year ago

Thanks for reporting this. I'm glad you managed to fix the issue on your end but in sorry it happened in the first place. The algorithm used probably needs a rewrite. I don't know if other people have had this issue, or if you're the only one who mentioned this specific issue? Either-way, I'll have a look.