summaryrefslogtreecommitdiffstats
path: root/src/Configuration.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-09-22 10:01:48 -0400
committerDavid Robillard <d@drobilla.net>2023-09-22 10:01:48 -0400
commite6831b0670cbb33414a541975b4a7de64841d243 (patch)
treead88b89eae54812ddea3c4b38d7747bb9b4d29d5 /src/Configuration.cpp
parent7bbf88d24483074193904d3fca4cd62948d4213e (diff)
downloadpatchage-e6831b0670cbb33414a541975b4a7de64841d243.tar.gz
patchage-e6831b0670cbb33414a541975b4a7de64841d243.tar.bz2
patchage-e6831b0670cbb33414a541975b4a7de64841d243.zip
Use anonymous namespaces
Diffstat (limited to 'src/Configuration.cpp')
-rw-r--r--src/Configuration.cpp59
1 files changed, 31 insertions, 28 deletions
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index a4d71e9..9bb2ac6 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -20,6 +20,37 @@
// IWYU pragma: no_include <algorithm>
namespace patchage {
+namespace {
+
+/// Return a vector of filenames in descending order by preference
+std::vector<std::string>
+get_filenames()
+{
+ std::vector<std::string> filenames;
+ const std::string prefix;
+
+ const char* xdg_config_home = getenv("XDG_CONFIG_HOME");
+ const char* home = getenv("HOME");
+
+ // XDG spec
+ if (xdg_config_home) {
+ filenames.push_back(std::string(xdg_config_home) + "/patchagerc");
+ } else if (home) {
+ filenames.push_back(std::string(home) + "/.config/patchagerc");
+ }
+
+ // Old location
+ if (home) {
+ filenames.push_back(std::string(home) + "/.patchagerc");
+ }
+
+ // Current directory (bundle or last-ditch effort)
+ filenames.emplace_back("patchagerc");
+
+ return filenames;
+}
+
+} // namespace
static const char* const port_type_names[Configuration::n_port_types] =
{"JACK_AUDIO", "JACK_MIDI", "ALSA_MIDI", "JACK_OSC", "JACK_CV"};
@@ -152,34 +183,6 @@ Configuration::set_module_split(const std::string& name, bool split)
}
}
-/** Return a vector of filenames in descending order by preference. */
-static std::vector<std::string>
-get_filenames()
-{
- std::vector<std::string> filenames;
- const std::string prefix;
-
- const char* xdg_config_home = getenv("XDG_CONFIG_HOME");
- const char* home = getenv("HOME");
-
- // XDG spec
- if (xdg_config_home) {
- filenames.push_back(std::string(xdg_config_home) + "/patchagerc");
- } else if (home) {
- filenames.push_back(std::string(home) + "/.config/patchagerc");
- }
-
- // Old location
- if (home) {
- filenames.push_back(std::string(home) + "/.patchagerc");
- }
-
- // Current directory (bundle or last-ditch effort)
- filenames.emplace_back("patchagerc");
-
- return filenames;
-}
-
void
Configuration::load()
{