"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libgnucash/core-utils/gnc-filepath-utils.cpp" between
gnucash-5.0.tar.bz2 and gnucash-5.1.tar.bz2

About: GnuCash is personal and small-business financial-accounting software.

gnc-filepath-utils.cpp  (gnucash-5.0.tar.bz2):gnc-filepath-utils.cpp  (gnucash-5.1.tar.bz2)
skipping to change at line 68 skipping to change at line 68
#define PATH_MAX MAXPATHLEN #define PATH_MAX MAXPATHLEN
#endif #endif
#endif #endif
#ifdef MAC_INTEGRATION #ifdef MAC_INTEGRATION
#include <Foundation/Foundation.h> #include <Foundation/Foundation.h>
#endif #endif
#include "gnc-locale-utils.hpp" #include "gnc-locale-utils.hpp"
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/locale.hpp> #include <boost/locale.hpp>
#include <regex>
#include <iostream> #include <iostream>
#include <numeric> #include <numeric>
/* Below cvt and bfs_locale should be used with boost::filesystem::path (bfs) /* Below cvt and bfs_locale should be used with boost::filesystem::path (bfs)
* objects created alter in this source file. The rationale is as follows: * objects created alter in this source file. The rationale is as follows:
* - a bfs object has an internal, locale and platform dependent * - a bfs object has an internal, locale and platform dependent
* representation of a file system path * representation of a file system path
* - glib's internal representation is always utf8 * - glib's internal representation is always utf8
* - when creating a bfs object, we should pass a cvt to convert from * - when creating a bfs object, we should pass a cvt to convert from
* utf8 to the object's internal representation * utf8 to the object's internal representation
skipping to change at line 212 skipping to change at line 213
* back anyway */ * back anyway */
g_warning("create new file %s", fullpath); g_warning("create new file %s", fullpath);
return fullpath; return fullpath;
} }
gchar *gnc_file_path_relative_part (const gchar *prefix, const gchar *path) gchar *gnc_file_path_relative_part (const gchar *prefix, const gchar *path)
{ {
std::string p{path}; std::string p{path};
if (p.find(prefix) == 0) if (p.find(prefix) == 0)
return g_strdup(p.substr(strlen(prefix)).c_str()); {
auto str = p.substr(strlen(prefix));
return g_strdup(str.c_str());
}
return g_strdup(path); return g_strdup(path);
} }
/* Searches for a file fragment paths set via GNC_DOC_PATH environment /* Searches for a file fragment paths set via GNC_DOC_PATH environment
* variable. If this variable is not set, fall back to search in * variable. If this variable is not set, fall back to search in
* - a html directory in the local user's gnucash settings directory * - a html directory in the local user's gnucash settings directory
* (typically $HOME/.gnucash/html) * (typically $HOME/.gnucash/html)
* - the gnucash documentation directory * - the gnucash documentation directory
* (typically /usr/share/doc/gnucash) * (typically /usr/share/doc/gnucash)
* - the gnucash data directory * - the gnucash data directory
skipping to change at line 1325 skipping to change at line 1329
}; };
auto accum = [](const auto& a, const auto& b) auto accum = [](const auto& a, const auto& b)
{ {
EnvPaths *ep = g_new0 (EnvPaths, 1); EnvPaths *ep = g_new0 (EnvPaths, 1);
*ep = b; *ep = b;
return g_list_prepend (a, ep); return g_list_prepend (a, ep);
}; };
return std::accumulate (paths.rbegin(), paths.rend(), (GList*) nullptr, accu m); return std::accumulate (paths.rbegin(), paths.rend(), (GList*) nullptr, accu m);
} }
static const std::regex
backup_regex (".*[.](?:xac|gnucash)[.][0-9]{14}[.](?:xac|gnucash)$");
gboolean gnc_filename_is_backup (const char *filename)
{
return std::regex_match (filename, backup_regex);
}
static const std::regex
datafile_regex (".*[.](?:xac|gnucash)$");
gboolean gnc_filename_is_datafile (const char *filename)
{
return !gnc_filename_is_backup (filename) &&
std::regex_match (filename, datafile_regex);
}
/* =============================== END OF FILE ========================== */ /* =============================== END OF FILE ========================== */
 End of changes. 3 change blocks. 
1 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)