cxong / cdogs-sdl

Classic overhead run-and-gun game
https://cxong.github.io/cdogs-sdl/
GNU General Public License v2.0
887 stars 114 forks source link

cdogs ignores leading dots in installation path #643

Closed sbuller closed 4 years ago

sbuller commented 4 years ago

I have taken the release tarball and installed it to ~/.local/tars/, when I try to run the executable it is unable to find a variety of files as it has removed the '.' in front of local.

[stefan@StefanFedora C-Dogs SDL-0.7.3-Linux]$ bin/cdogs-sdl
C-Dogs SDL v0.7.3
20200419-150605 INFO  [MAIN ] [files.c:651] SetupConfigDir(): Creating config dir /home/stefan/.config/cdogs-sdl/...
20200419-150605 INFO  [MAIN ] [files.c:656] SetupConfigDir(): Config dir already exists.
Error loading config '/home/stefan/.config/cdogs-sdl/options.cnf'
Error loading autosave '/home/stefan/.config/cdogs-sdl/autosave.json'
20200419-150605 INFO  [MAIN ] [cdogs.c:160] main(): Command line (1 args): bin/cdogs-sdl
20200419-150606 INFO  [MAIN ] [cdogs.c:189] main(): data dir(/home/stefan/.local/tars)
20200419-150606 INFO  [MAIN ] [cdogs.c:190] main(): config dir(/home/stefan/.config/cdogs-sdl/)
20200419-150606 ERROR [MAIN ] [sounds.c:257] SoundLoadMusic(): Cannot open music dir /home/stefan/local/tars/music/menu: No such file or directory
20200419-150606 ERROR [MAIN ] [sounds.c:257] SoundLoadMusic(): Cannot open music dir /home/stefan/local/tars/music/briefing: No such file or directory
20200419-150606 ERROR [MAIN ] [sounds.c:257] SoundLoadMusic(): Cannot open music dir /home/stefan/local/tars/music/game: No such file or directory
20200419-150606 ERROR [INPUT] [joystick.c:47] JoyInit(): cannot load controller mappings file: Invalid RWops
20200419-150606 ERROR [INPUT] [joystick.c:53] JoyInit(): cannot load button mappings file: Cannot open file
20200419-150606 INFO  [INPUT] [joystick.c:60] JoyInit(): 0 controllers found
20200419-150606 INFO  [GFX  ] [grafx.c:121] GraphicsInitialize(): graphics mode(320x240 2x)
Error reading JSON file '/home/stefan/local/tars/graphics/font.json'
20200419-150606 ERROR [MAIN ] [font_utils.c:40] FontLoadFromJSON(): Error parsing font JSON '/home/stefan/local/tars/graphics/font.json'
Error reading JSON file '/home/stefan/local/tars/graphics/font.json'
20200419-150606 ERROR [MAIN ] [font_utils.c:40] FontLoadFromJSON(): Error parsing font JSON '/home/stefan/local/tars/graphics/font.json'
20200419-150606 ERROR [MAIN ] [particle.c:69] ParticleClassesInit(): Error: cannot load particles file /home/stefan/local/tars/data/particles.json
20200419-150606 ERROR [MAIN ] [ammo.c:84] AmmoInitialize(): Error: cannot load ammo file /home/stefan/local/tars/data/ammo.json
20200419-150606 ERROR [MAP  ] [weapon_class.c:556] BulletAndWeaponInitialize(): Error: cannot load bullets file /home/stefan/local/tars/data/bullets.json
20200419-150606 ERROR [MAIN ] [character_class.c:233] CharacterClassesInitialize(): cannot load characters file /home/stefan/local/tars/data/character_classes.json
20200419-150606 ERROR [MAIN ] [player_template.c:107] PlayerTemplatesLoad(): loading player templates 'players.cnf'
20200419-150606 ERROR [MAIN ] [pickup_class.c:182] PickupClassesInit(): Error: cannot load pickups file /home/stefan/local/tars/data/pickups.json
20200419-150606 ERROR [MAIN ] [map_object.c:249] MapObjectsInit(): Error: cannot load map objects file /home/stefan/local/tars/data/map_objects.json
Error: cannot load /home/stefan/local/tars/doc/CREDITS
20200419-150606 INFO  [MAIN ] [campaigns.c:103] LoadAllCampaigns(): Load campaigns from dir /home/stefan/local/tars/missions...
Cannot load campaigns from path /home/stefan/local/tars/missions
20200419-150606 INFO  [MAIN ] [campaigns.c:111] LoadAllCampaigns(): Load dogfights from dir /home/stefan/local/tars/dogfights...
Cannot load campaigns from path /home/stefan/local/tars/dogfights
20200419-150606 INFO  [MAIN ] [campaigns.c:118] LoadAllCampaigns(): Load quick play...
20200419-150606 INFO  [MAIN ] [cdogs.c:267] main(): Starting game
Floating point exception (core dumped)
sbuller commented 4 years ago

And now I notice that it's actually missing a whole directory from the path:

[stefan@StefanFedora C-Dogs SDL-0.7.3-Linux]$ pwd
/home/stefan/.local/tars/C-Dogs SDL-0.7.3-Linux

Which leads me to discover that cd bin; ./cdogs-sdl fixes both problems. I can work with this.

cxong commented 4 years ago

yep; the binary assumes data will be in .. so it should be run in its own folder and not from the folder above; it's a bit of a hassle