Commit Graph

16 Commits

Author SHA1 Message Date
Christopher Lam
89f7e8933b gnc_list_all_paths returns std::vector instead of GList of EnvPaths
because its consumers are now cpp there's no need to return a GList.
2023-05-22 09:45:33 +08:00
John Ralls
9b95419608 Fix glib include. 2023-05-11 11:56:23 -07:00
John Ralls
d696f0cfcb Bug 798885 - Accented character in folder name on Account Export (bis)
Pass a boost::filesystem's c_str() rv to the ofstream constructor to
keep libstdc++ from transcoding it back to UTF8 and creating a broken
name or failing to match the directory name. Implemented in
gnc-filepath-utils to avoid spreading the boost::filesystem dependency
throughout the code base.

See https://github.com/boostorg/filesystem/issues/181 for why other
approaches don't work.
2023-05-08 13:35:21 -07:00
Christopher Lam
dd0d65d861 [1/2] [gnc-filepath-utils.cpp] gnc_filename_is_backup|datafile
uses std::regex to test filename
2023-03-16 18:01:09 +08:00
Richard Cohen
1cec0cb3f3 Use internal extern "C" { ... } for C++
- removes warnings compiling swig engine
...
[ 10%] Generating swig-engine.cpp
.../libgnucash/engine/engine-helpers.h:31: Warning 313: Unrecognized extern type "C++".
.../libgnucash/engine/gnc-date.h:83: Warning 313: Unrecognized extern type "C++".
.../libgnucash/engine/qofquery.h:90: Warning 302: Identifier 'QofQuery' redefined (ignored),
.../libgnucash/engine/gnc-option.hpp:55: Warning 302: previous definition of 'QofQuery'.
.../libgnucash/engine/gnc-commodity.h:56: Warning 313: Unrecognized extern type "C++".
.../libgnucash/engine/gncBusiness.h:40: Warning 313: Unrecognized extern type "C++".
.../libgnucash/engine/gncEntry.h:37: Warning 313: Unrecognized extern type "C++".
2023-01-23 18:40:01 +00:00
Christopher Lam
263f007d5c [gnc-filepath-utils] new: gnc_list_all_paths 2022-07-10 23:44:13 +08:00
Geert Janssens
93489d4ffc RptCleanup - Generalize report loading function to allow use for modules other than the reports 2019-06-18 14:25:04 +02:00
Geert Janssens
6c5fc4da29 Report fs cleanup - Add a few convenience functions
These will provide easy access to some of the most important
scm related runtime directories
2019-05-24 21:11:09 +02:00
Robert Fewell
22a7a05d50 Add function to create an absolute file path
Add function to create an absolute file path from a prefix path and a
relative one. If the prefix is null, then the root directory of the
current path is used.
2019-03-29 20:43:00 +00:00
Geert Janssens
61a21d12c6 Look for user editable config files in gnc_userconfig_dir instead of gnc_userdata_dir
At present these are
- log.conf
- config-user.scm (previously config.user-2.0)

Implement one-time migration of these files to the proper directory if they previously exist
Look for a log.conf file in gnc_userconfig_dir instead of gnc_userdata_dir

Note this commit also uses boost::locale::translate for the first time.
We may need to fine-tune our use, but in the current state strings marked
for translation using that function are already picked up for gnucash.pot.
2018-02-24 20:39:26 +01:00
Robert Fewell
7c9ac17cb6 Move the user CSS settings file
Move the CSS settings file to a location based on XDG_CONFIG_HOME which
is OS dependant but with slight changes for Windows and OS X.

- Windows: CSIDL_APPDATA/Gnucash
- OS X: $HOME/Application Support/Gnucash
- Linux: $XDG_CONFIG_HOME/gnucash (or the default $HOME/.config/gnucash)
2018-02-18 22:40:45 +00:00
Geert Janssens
2f16b092f5 Simplify filepath init code
It will no longer attempt to use /home/janssege/.gnucash. That was
requiring lots of extra conditions.
It will also default to a base directory (gnc_data_home) in the
build dir if it detects the code is run during building or testing.
That again allows to simplify it as there's no need for temp dir
juggling in case the build environment doesn't have a writable home dir.
2018-02-01 19:17:17 +01:00
John Ralls
66817bb997 Rework directory determination in CMake builds.
Sets paths for finding componenents depending on the state of ENABLE_BINRELOC,
GNC_UNINSTALLED, GNC_BUILDDIR and whether any install paths have been set
outside of CMAKE_INSTALL_PREFIX.

GNUInstallDirs changes the name of CMAKE_INSTALL_LIBDIR depending on the
operating system and distro. When CMAKE_INSTALL_PREFIX is /usr,
/usr/local, or any subdirectory of /opt it also changes
CMAKE_INSTALL_FULL_SYSCONFDIR to /etc. An earlier commit by Aaron Laws
mirrors the name of CMAKE_INSTALL_LIBDIR to the build library directory.

It's possible for builders to set any of the install directories
anywhere they please.

Setting any directory outside of CMAKE_INSTALL_PREFIX breaks Binreloc so
the toplevel CMakeLists.txt now detects that and disables Binreloc.

If Binreloc is enabled then all path queries use it to find paths. This
works in the build directory because the gnucash executable and all of
the test programs are in build_directory/bin and LIBDIR, DATADIR, and
SYSCONFDIR can be found in the same root path.

If Binreloc is disabled then in order to build or run programs from the
build directory one must set GNC_UNINSTALLED and set GNC_BUILDDIR to the
absolute path of the build directory. When those are set GNC_BUILDDIR
replaces CMAKE_INSTALL_PREFIX in all paths that are subdirectories of
CMAKE_INSTALL_PREFIX; paths that are not in CMAKE_INSTALL_PREFIX are
appended whole to GNC_BUILDDIR. This process is constent between CMake
and gnc_path_get_foo. GnuCash is unlikely to run from a DESTDIR without
Binreloc.
2017-12-05 17:25:52 -08:00
Geert Janssens
a153412e5a Use platform dependent locations for gnucash user's data (gnc_userdata_home)
- Linux: use whatever the xdg spec dictates
- Windows: use AppData(Roaming)
- OS X/Quarz: use NSApplicationSupportDirectory special directory, which
              typically resolves to $HOME/Library/Application Support

If the preferred directory can't be used the code will fallback to
$HOME/.gnucash (the old location) if it exists. It won't create it
however. Instead if missing it will fall back to the platform's
temporary directory.

Code is added also to automatically migrate all data from the old
location to the new (only the first time).
2017-08-26 21:38:21 +02:00
Geert Janssens
ae75bc963f Rewrite several file path routines to use boost::filesystem
This is a basis for moving .gnucash to a more modern location for
application specific user data (following the xdg spec).
2017-08-26 21:38:21 +02:00
Geert Janssens
83d14e1c1c Restructure the src directory
It is split into
- /libgnucash (for the non-gui bits)
- /gnucash (for the gui)
- /common (misc source files used by both)
- /bindings (currently only holds python bindings)

This is the first step in restructuring the code. It will need much
more fine tuning later on.
2017-08-10 18:45:00 +02:00