forward port 2.X changes up to and including rev 6909
git-svn-id: svn://localhost/ardour2/branches/3.0@7639 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
6ad57df62b
commit
a5e74a774c
@ -22,6 +22,9 @@
|
||||
#include <inttypes.h>
|
||||
#include <cstdio>
|
||||
#include <errno.h>
|
||||
|
||||
#include <glibmm/miscutils.h>
|
||||
|
||||
#include "pbd/error.h"
|
||||
#include "pbd/enumwriter.h"
|
||||
|
||||
@ -98,7 +101,7 @@ Automatable::load_automation (const string& path)
|
||||
{
|
||||
string fullpath;
|
||||
|
||||
if (path[0] == '/') { // legacy
|
||||
if (Glib::path_is_absolute (path)) { // legacy
|
||||
fullpath = path;
|
||||
} else {
|
||||
fullpath = _a_session.automation_dir();
|
||||
|
@ -215,7 +215,7 @@ FileSource::find (DataType type, const ustring& path, bool must_exist,
|
||||
|
||||
isnew = false;
|
||||
|
||||
if (pathstr[0] != '/') {
|
||||
if (!Glib::path_is_absolute (pathstr)) {
|
||||
|
||||
/* non-absolute pathname: find pathstr in search path */
|
||||
|
||||
@ -234,12 +234,8 @@ FileSource::find (DataType type, const ustring& path, bool must_exist,
|
||||
cnt = 0;
|
||||
|
||||
for (vector<ustring>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
|
||||
fullpath = *i;
|
||||
if (fullpath[fullpath.length()-1] != '/') {
|
||||
fullpath += '/';
|
||||
}
|
||||
|
||||
fullpath += pathstr;
|
||||
|
||||
fullpath = Glib::build_filename (*i, pathstr);
|
||||
|
||||
/* i (paul) made a nasty design error by using ':' as a special character in
|
||||
Ardour 0.99 .. this hack tries to make things sort of work.
|
||||
@ -263,13 +259,7 @@ FileSource::find (DataType type, const ustring& path, bool must_exist,
|
||||
*/
|
||||
|
||||
ustring shorter = pathstr.substr (0, pos);
|
||||
fullpath = *i;
|
||||
|
||||
if (fullpath[fullpath.length()-1] != '/') {
|
||||
fullpath += '/';
|
||||
}
|
||||
|
||||
fullpath += shorter;
|
||||
fullpath = Glib::build_filename (*i, shorter);
|
||||
|
||||
if (Glib::file_test (pathstr, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) {
|
||||
chan = atoi (pathstr.substr (pos+1));
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include <climits>
|
||||
#include <cerrno>
|
||||
|
||||
#include <glibmm/miscutils.h>
|
||||
|
||||
#include "pbd/compose.h"
|
||||
#include "pbd/error.h"
|
||||
|
||||
@ -53,17 +55,13 @@ ARDOUR::find_session (string str, string& path, string& snapshot, bool& isnew)
|
||||
|
||||
if (S_ISDIR (statbuf.st_mode)) {
|
||||
|
||||
string::size_type slash = str.find_last_of ('/');
|
||||
string::size_type slash = str.find_last_of (G_DIR_SEPARATOR);
|
||||
|
||||
if (slash == string::npos) {
|
||||
|
||||
/* a subdirectory of cwd, so statefile should be ... */
|
||||
|
||||
string tmp;
|
||||
tmp = str;
|
||||
tmp += '/';
|
||||
tmp += str;
|
||||
tmp += statefile_suffix;
|
||||
string tmp = Glib::build_filename (str, str+statefile_suffix);
|
||||
|
||||
/* is it there ? */
|
||||
|
||||
@ -90,7 +88,7 @@ ARDOUR::find_session (string str, string& path, string& snapshot, bool& isnew)
|
||||
|
||||
} else if (S_ISREG (statbuf.st_mode)) {
|
||||
|
||||
string::size_type slash = str.find_last_of ('/');
|
||||
string::size_type slash = str.find_last_of (G_DIR_SEPARATOR);
|
||||
string::size_type suffix;
|
||||
|
||||
/* remove the suffix */
|
||||
@ -148,7 +146,7 @@ ARDOUR::find_session (string str, string& path, string& snapshot, bool& isnew)
|
||||
as "dirname" does.
|
||||
*/
|
||||
|
||||
string::size_type slash = str.find_last_of ('/');
|
||||
string::size_type slash = str.find_last_of (G_DIR_SEPARATOR);
|
||||
|
||||
if (slash == string::npos) {
|
||||
|
||||
|
@ -174,8 +174,8 @@ get_paths_for_new_sources (HeaderFormat hf, const bool allow_replacing, const st
|
||||
std::string filepath = (type == DataType::MIDI)
|
||||
? sdir.midi_path().to_string() : sdir.sound_path().to_string();
|
||||
|
||||
filepath += '/';
|
||||
filepath += get_non_existent_filename (hf, type, allow_replacing, filepath, basename, n, channels);
|
||||
filepath = Glib::build_filename (filepath,
|
||||
get_non_existent_filename (hf, type, allow_replacing, filepath, basename, n, channels));
|
||||
new_paths.push_back (filepath);
|
||||
}
|
||||
|
||||
|
@ -514,7 +514,7 @@ MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_
|
||||
|
||||
adjust_capture_position = 0;
|
||||
|
||||
if (nominally_recording || (_session.get_record_enabled() && _session.config.get_punch_in())) {
|
||||
if (nominally_recording || (re && was_recording && _session.get_record_enabled() && _session.config.get_punch_in())) {
|
||||
OverlapType ot = coverage (first_recordable_frame, last_recordable_frame, transport_frame, transport_frame + nframes);
|
||||
|
||||
calculate_record_range(ot, transport_frame, nframes, rec_nframes, rec_offset);
|
||||
|
@ -201,7 +201,7 @@ PluginManager::ladspa_refresh ()
|
||||
case ':' :
|
||||
case '\0':
|
||||
continue;
|
||||
case '/' :
|
||||
case G_DIR_SEPARATOR :
|
||||
if (ladspa_path[found + strlen(standard_paths[i]) + 1] == ':' ||
|
||||
ladspa_path[found + strlen(standard_paths[i]) + 1] == '\0') {
|
||||
continue;
|
||||
|
@ -145,7 +145,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
|
||||
_path = string(buf);
|
||||
|
||||
if (_path[_path.length()-1] != '/') {
|
||||
_path += '/';
|
||||
_path += G_DIR_SEPARATOR;
|
||||
}
|
||||
|
||||
if (Glib::file_test (_path, Glib::FILE_TEST_EXISTS) && ::access (_path.c_str(), W_OK)) {
|
||||
@ -2225,7 +2225,7 @@ remove_end(string* state)
|
||||
string statename(*state);
|
||||
|
||||
string::size_type start,end;
|
||||
if ((start = statename.find_last_of ('/')) != string::npos) {
|
||||
if ((start = statename.find_last_of (G_DIR_SEPARATOR)) != string::npos) {
|
||||
statename = statename.substr (start+1);
|
||||
}
|
||||
|
||||
@ -2398,7 +2398,7 @@ Session::find_all_sources (string path, set<string>& result)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (prop->value()[0] == '/') {
|
||||
if (Glib::path_is_absolute (prop->value())) {
|
||||
/* external file, ignore */
|
||||
continue;
|
||||
}
|
||||
@ -2427,7 +2427,7 @@ Session::find_all_sources_across_snapshots (set<string>& result, bool exclude_th
|
||||
|
||||
ripped = _path;
|
||||
|
||||
if (ripped[ripped.length()-1] == '/') {
|
||||
if (ripped[ripped.length()-1] == G_DIR_SEPARATOR) {
|
||||
ripped = ripped.substr (0, ripped.length() - 1);
|
||||
}
|
||||
|
||||
@ -2634,18 +2634,16 @@ Session::cleanup_sources (CleanupReport& rep)
|
||||
newpath = Glib::path_get_dirname (newpath); // "session-dir"
|
||||
}
|
||||
|
||||
newpath += '/';
|
||||
newpath += dead_sound_dir_name;
|
||||
newpath = Glib::build_filename (newpath, dead_sound_dir_name);
|
||||
|
||||
if (g_mkdir_with_parents (newpath.c_str(), 0755) < 0) {
|
||||
error << string_compose(_("Session: cannot create session peakfile folder \"%1\" (%2)"), newpath, strerror (errno)) << endmsg;
|
||||
return -1;
|
||||
}
|
||||
|
||||
newpath += '/';
|
||||
newpath += Glib::path_get_basename ((*x));
|
||||
|
||||
if (access (newpath.c_str(), F_OK) == 0) {
|
||||
newpath = Glib::build_filename (newpath, Glib::path_get_basename ((*x)));
|
||||
|
||||
if (Glib::file_test (newpath, Glib::FILE_TEST_EXISTS)) {
|
||||
|
||||
/* the new path already exists, try versioning */
|
||||
|
||||
|
@ -205,7 +205,7 @@ path_is_paired (ustring path, ustring& pair_base)
|
||||
|
||||
/* remove any leading path */
|
||||
|
||||
if ((pos = path.find_last_of ('/')) != string::npos) {
|
||||
if ((pos = path.find_last_of (G_DIR_SEPARATOR)) != string::npos) {
|
||||
path = path.substr(pos+1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user