kukugt / mupen64plus

Automatically exported from code.google.com/p/mupen64plus
0 stars 0 forks source link

Implement XDG Base Directory Specification #137

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Describe your system:
 - Linux distribution: All (Ubuntu for me)
 - Machine type: (32-bit or 64-bit) All
 - Mupen64Plus version: 1.4
 - Plugins used: N/A

Describe the problem:
http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html

This standard should be implemented for mupen64plus, especially the
$XDG_CONFIG_HOME spec. The config folder should be in the shell variable
$XDG_CONFIG_HOME/mupen64plus or ~/.config/mupen64plus by default, instead
of the current ~/.mupen64plus

This specification has several useful features, such as cleaning up the
cluttered home directory into logical folders, allowing easy backing up of
all config files, giving a single place to go to to delete config files in
case of any problems. It provides good consistency for linux.

I hope you consider it

If my examiniation of the source is correct, this should mean changing the
file main.c

-----Change the section ----

    // if the config dir was not specified at the commandline, look for
~/.mupen64plus dir
    if (strlen(l_ConfigDir) == 0)
    {
        strncpy(l_ConfigDir, getenv("HOME"), PATH_MAX);
        strncat(l_ConfigDir, "/.mupen64plus", PATH_MAX - strlen(l_ConfigDir));

        // if ~/.mupen64plus dir is not found, create it

---- to ----

    // if the config dir was not specified at the commandline, look for
~/.config/mupen64plus dir
    if (strlen(l_ConfigDir) == 0)
    {
        if (strlen(getenv("XDG_CONFIG_HOME")) == 0) 
        {
        strncpy(l_ConfigDir, getenv("HOME"), PATH_MAX);
        strncat(l_ConfigDir, "/.config/mupen64plus", PATH_MAX -
strlen(l_ConfigDir));
        }
        else
        {
        strncpy(l_ConfigDir, getenv("XDG_CONFIG_HOME"), PATH_MAX);
        }
        // if ~/.config/mupen64plus dir is not found, create it

Original issue reported on code.google.com by duncan.hawthorne on 8 Aug 2008 at 6:21

GoogleCodeExporter commented 8 years ago
sorry, close to being right, change it to:

-----Change the section ----

    // if the config dir was not specified at the commandline, look for
~/.mupen64plus dir
    if (strlen(l_ConfigDir) == 0)
    {
        strncpy(l_ConfigDir, getenv("HOME"), PATH_MAX);
        strncat(l_ConfigDir, "/.mupen64plus", PATH_MAX - strlen(l_ConfigDir));

        // if ~/.mupen64plus dir is not found, create it

---- to ----

    // if the config dir was not specified at the commandline, look for
~/.config/mupen64plus dir
    if (strlen(l_ConfigDir) == 0)
    {
        if (strlen(getenv("XDG_CONFIG_HOME")) == 0) 
        {
        strncpy(l_ConfigDir, getenv("HOME"), PATH_MAX);
        strncat(l_ConfigDir, "/.config/mupen64plus", PATH_MAX -
strlen(l_ConfigDir));
        }
        else
        {
        strncpy(l_ConfigDir, getenv("XDG_CONFIG_HOME"), PATH_MAX);
        strncat(l_ConfigDir, "/mupen64plus", PATH_MAX -
strlen(l_ConfigDir));
        }
        // if ~/.config/mupen64plus dir is not found, create it

Original comment by duncan.hawthorne on 8 Aug 2008 at 9:33

GoogleCodeExporter commented 8 years ago
I'd like to cast a vote for this. Alot of software (at least typical desktop
software) are starting to respect this standard, and adding mupen64plus to 
those will
help consistency of the system overall.

Original comment by micket...@gmail.com on 31 Dec 2008 at 12:50

GoogleCodeExporter commented 8 years ago
issue #192 is a duplicate of this, and also contains a patch.

Original comment by richard...@gmail.com on 4 Jan 2009 at 7:57

GoogleCodeExporter commented 8 years ago
The xdg standard is more complex and a patch for that can be found at
http://git.debian.org/?p=collab-maint/mupen64plus.git;a=tree;f=debian/patches;hb
=master

It is again 1.5+dfsg1. So it wasn't made with glN64 or any new plugins in mind.
Please read the commit message of the message for more informations

Original comment by sven@narfation.org on 31 Aug 2009 at 10:44

Attachments:

GoogleCodeExporter commented 8 years ago
The patch was ported to the current trunk r1404 and checked against glN64 and 
z64 for
generated data/cache files. The commit message is the same.

---
The freedesktop standard for basedir[1] defines three different types of user
directories which mupen64plus uses. They are defined by environment variables 
and in
the case if they are absend by well defined standard paths.

 * Data directory ($XDG_DATA_HOME); default: $HOME/.local/share/
   - save, screenshots, hires_texture, texture_dump
 * Config directory ($XDG_CONFIG_HOME); default: $HOME/.config/
   - mupen64plus.conf, configuration files of plugins
 * Cache directory ($XDG_DATA_HOME); default: $HOME/.cache/
   - rombrowser.cache and all other files which could be deleted
     without loosing essential data

Specific directories for each tool should be created below that base 
directories.
libxdg-basedir can be used to find the correct paths without caring much about 
the
actual specification.

The current config dir has to be splitted in these three different directories. 
That
also means that plugins have to be informed about that dirs. New functions 
SetDataDir
and SetCacheDir have been specified inside the API headers and implemented were 
the
plugin would benefit from it. This is the case in rice_video for texture_dump 
and
hires_texture.

The user can also override the data and cache directories by the new commandline
options --datadir and --cachedir.

As there is no real specification for Windows available the behavior on that 
platform
was not changed.

[1] http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
---
 Makefile                      |    3 +-
 blight_input/Input_1.1.h      |   22 ++++++++
 doc/Audio_1.1.h               |   22 ++++++++
 doc/Audio_1.2.h               |   22 ++++++++
 doc/Graphics_1.3.h            |   22 ++++++++
 doc/Input_1.1.h               |   22 ++++++++
 dummy_audio/Audio_1.1.h       |   22 ++++++++
 dummy_input/Input_1.1.h       |   22 ++++++++
 dummy_video/Graphics_1.3.h    |   22 ++++++++
 glN64/Zilmar GFX 1.3.h        |   22 ++++++++
 glide64/Gfx1.3.h              |   22 ++++++++
 jttl_audio/Audio_1.2.h        |   22 ++++++++
 main/main.c                   |  121 +++++++++++++++++++++++++++++++++++------
 main/main.h                   |    2 +
 main/plugin.c                 |   12 ++++-
 main/plugin.h                 |    2 +-
 main/romcache.c               |    2 +-
 pre.mk                        |    9 +++
 rice_video/Graphics_1.3.h     |   22 ++++++++
 rice_video/TextureFilters.cpp |    8 ++--
 rice_video/Video.cpp          |   80 ++++++++++++++++++++++++++--
 rsp_hle/Audio_1.1.h           |   22 ++++++++
 z64/Gfx #1.3.h                |   22 ++++++++
 23 files changed, 517 insertions(+), 30 deletions(-)

Original comment by sven@narfation.org on 31 Aug 2009 at 11:13

GoogleCodeExporter commented 8 years ago
Updated patch to have the saves at the correct place.

Original comment by sven@narfation.org on 1 Sep 2009 at 12:40

Attachments:

GoogleCodeExporter commented 8 years ago
This feature has been implemented with the re-architecture of the Mupen64Plus 
project.

Original comment by richard...@gmail.com on 12 Jan 2010 at 4:50