mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
move Paths Dialog to libgtkmm2ext
This commit is contained in:
parent
f8ec1d1f27
commit
3cf5dcb64c
7 changed files with 54 additions and 59 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2013 Paul Davis
|
||||
Copyright (C) 2013-2014 Paul Davis
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -25,10 +25,12 @@
|
|||
|
||||
#include <regex.h>
|
||||
|
||||
#include <glibmm/fileutils.h>
|
||||
#include <glibmm/miscutils.h>
|
||||
|
||||
#include "pbd/pathexpand.h"
|
||||
#include "pbd/strsplit.h"
|
||||
#include "pbd/tokenizer.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
|
@ -192,3 +194,29 @@ PBD::search_path_expand (string path)
|
|||
|
||||
return r;
|
||||
}
|
||||
|
||||
std::vector <std::string>
|
||||
PBD::parse_path(std::string path, bool check_if_exists)
|
||||
{
|
||||
vector <std::string> pathlist;
|
||||
vector <std::string> tmp;
|
||||
PBD::tokenize (path, string(G_SEARCHPATH_SEPARATOR_S), std::back_inserter (tmp));
|
||||
|
||||
for(vector<std::string>::const_iterator i = tmp.begin(); i != tmp.end(); ++i) {
|
||||
if ((*i).empty()) continue;
|
||||
std::string dir;
|
||||
#ifndef PLATFORM_WINDOWS
|
||||
if ((*i).substr(0,1) == "~") {
|
||||
dir = Glib::build_filename(Glib::get_home_dir(), (*i).substr(1));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
dir = *i;
|
||||
}
|
||||
if (!check_if_exists || Glib::file_test (dir, Glib::FILE_TEST_IS_DIR)) {
|
||||
pathlist.push_back(dir);
|
||||
}
|
||||
}
|
||||
return pathlist;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue