File search paths and CLI options

edited August 2015 in EmptyEpsilon
Sorry, not certain where to submit this properly. If this isn't it, I'll go find the right place:
Technical suggesstion re linux/unix build/install the packs/, resources/ and scripts/ directories might better be placed be under /usr/local/share/emptyepsilon (or EmptyEpsilon) to prevent accidental overwriting by other applications with similar directories. Further the /usr/local/share/emptyepsilon folder should be searched by default when attempting to open script resource or packs files.. 

Personal choice.. recommend searching 
~/.emptyepsilon/ 
/usr/local/share/emptyepsilon/
/usr/share/emptyepsilon/
./

Have CLI options been added as yet? If not would you be interested in me poking about and suggesting some with apropos code? Sorry, I've not directly contributed to an opensource project. I tend to be a troubleshooter that debugs breakage and proposes solutions... Something of an Unix  IT  firefighter for the last 25 years.

Comments

  • CLI options can overwrite/set any of the options.ini settings, but that's it.

    For example, I run "./EmptyEpsilon fullscreen=0" to force it into window mode when I'm developing.

    Adding extra/different search paths is extremely easy, due to the modular resource provider design:

    I simply haven't done any work for linux packaging at all.
  • Ok rather than hijacking  the building from source thread... I'll put my 'fixes' here. feel encouraged to use them irregardless of attribution... they really aren't much and as a programmer you probably have cleaner methods:
    main.cpp
    #Line 55 Insert 12 lines
    #ifdef __linux__
        char usertempvar[1024];
        const char* userconfigdir = \
    strcat(strcpy(usertempvar,getenv("HOME")),"/.emptyepsilon");
        char useroptionsfile[1024];
        strcpy(useroptionsfile,userconfigdir);
        strcat(useroptionsfile,"/options.ini");
        char userhardwarefile[1024];
        strcpy(userhardwarefile,userconfigdir);
        strcat(userhardwarefile,"/hardware.ini");
        PreferencesManager::load("/usr/local/share/emptyepsilon/options.ini");
        PreferencesManager::load(useroptionsfile);
    #endif    
    #End Insert

    #Line 77 (previously line 65) insert 26 lines
    #ifdef __linux__
        new DirectoryResourceProvider("/usr/local/share/resources/");
        new DirectoryResourceProvider("/usr/local/share/scripts/");
        new DirectoryResourceProvider("/usr/local/share/packs/SolCommand/");
        new PackResourceProvider("/usr/local/share/emptyepsilon/packs/Angryfly.pack");
        new DirectoryResourceProvider("/usr/share/resources/");
        new DirectoryResourceProvider("/usr/share/scripts/");
        new DirectoryResourceProvider("/usr/share/packs/SolCommand/");
        new PackResourceProvider("/usr/share/emptyepsilon/packs/Angryfly.pack");
        char userresourcesdir[1024];
        strcpy(userresourcesdir,userconfigdir);
        strcat(userresourcesdir,"/resources/");
        char userscriptsdir[1024];
        strcpy(userscriptsdir,userconfigdir);
        strcat(userscriptsdir,"/scripts/");
        char userpackssoldir[1024];
        strcpy(userpackssoldir,userconfigdir);
        strcat(userpackssoldir,"/packs/SolCommand");
        char userpacksAngryflydir[1024];
        strcpy(userpacksAngryflydir,userconfigdir);
        strcat(userpacksAngryflydir,"/packs/Angryfly.pack");
        new DirectoryResourceProvider(userresourcesdir);
        new DirectoryResourceProvider(userscriptsdir);
        new DirectoryResourceProvider(userpackssoldir);
        new PackResourceProvider(userpacksAngryflydir);
    #endif
    #End Insert

    #New Line 228 (previously line 180) replace 1 line with 6 lines:
    #ifdef __linux__
        hardware_controller->loadConfiguration("/usr/local/share/emptyepsilon/hardware.ini");
        hardware_controller->loadConfiguration(userhardwarefile);
    #else
        hardware_controller->loadConfiguration("hardware.ini");
    #endif   
     #End Replace

    #New Line 246 (previously line 198) replace wiht 5 lines
    #ifdef __linux__
        PreferencesManager::save(useroptionsfile);
    #else
        PreferencesManager::save("options.ini");
    #endif    
    #End Replace



    Effects: load system wide defaults from /usr/share/emptyepsilon then /usr/local/share/emptyepsilon and then load users personal overriding options/resources from $HOME/.emptyepsilon. You may even want to usurop the code for the userconfigdir stuff for the windows side as it also has a %HOME% which I believe the getenv would pick up... You may also feel perfectly welcome to tell my nosey carcass just where to stuff it. I won't be offended significantly..although I may ask why,
  • Many thanks! I never think that people who put effort in trying to improve thing should be told to stuff it.


    But, tip, the command "git diff" will give you all your local changes. So "git diff > ee.patch" will store this in a file. Should save you a lot of manual seeking out which line numbers next time you fix something.
  • I've done some re-work on your changes.

    First off, instead of the plain "C" code to strcat different string together, I'm using the string() object that I already have, making it one line instead of 10.

    I've changed the "HOME" environment checking not based on __linux__ but made it more general, just checking if $HOME is set or not. This makes it work for OSX as well. On windows $HOME is not defined. So it defaults to the current install directory.

    And, I've added the "INSTALL_PREFIX", to properly look at the location where resources have been deployed, as well as fixed installing stuff in /usr/local/share/emptyepsilon instead of /usr/local/share
    (This is the normal way to do this on linux)

    In general this is the patch now:
    (still checking if the make install works properly now, but my linux machine is slow in compiling)
  • Succesful build and run!

  • Yay!

    Going from this to a .deb package is not that much harder (thanks to CPack), but the SFML-2.3.1 dependency would be problematic, as no package manager ships that yet...
  • YUM.. there are SFML rpms for fedora 22

Sign In or Register to comment.