~ubuntu-branches/ubuntu/lucid/ardour/lucid-proposed

« back to all changes in this revision

Viewing changes to libs/ardour/session_state.cc

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2008-07-29 11:27:04 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20080729112704-x1rmgb4tjotjyu5u
Tags: 1:2.5-0ubuntu1
* New upstream release.
* debian/patches/s390-FTBFS.patch: Dropped, as it fails to apply, and
  Ubuntu doesn't concern itself with s390.
* debian/control:
  - Fix package description, thanks to the patch in Debian bug #485892.
  - Metadata cleanup and sync control/control.in files.
  - Add libaubio-dev to Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
411
411
                sp.path = path;
412
412
                sp.blocks = 0;
413
413
                session_dirs.push_back (sp);
414
 
 
415
 
                string fspath;
416
 
 
417
414
                /* sounds dir */
418
415
 
419
 
                fspath += sp.path;
420
 
                if (fspath[fspath.length()-1] != '/') {
421
 
                        fspath += '/';
422
 
                }
423
 
 
424
 
                fspath += sound_dir (false);
425
 
                
426
 
                AudioFileSource::set_search_path (fspath);
427
 
 
 
416
                AudioFileSource::set_search_path (Glib::build_filename(sp.path, sound_dir (false)));
428
417
                return;
429
418
        }
430
419
 
438
427
 
439
428
                /* add sounds to file search path */
440
429
 
441
 
                fspath += sp.path;
442
 
                if (fspath[fspath.length()-1] != '/') {
443
 
                        fspath += '/';
444
 
                }
445
 
                fspath += sound_dir (false);
 
430
                fspath += Glib::build_filename(sp.path, sound_dir (false));
446
431
                fspath += ':';
447
432
 
448
433
                remaining = remaining.substr (colon+1);
454
439
                sp.path = remaining;
455
440
 
456
441
                fspath += ':';
457
 
                fspath += sp.path;
458
 
                if (fspath[fspath.length()-1] != '/') {
459
 
                        fspath += '/';
460
 
                }
461
 
                fspath += sound_dir (false);
 
442
                fspath += Glib::build_filename(sp.path, sound_dir (false));
462
443
                fspath += ':';
463
444
 
464
445
                session_dirs.push_back (sp);
1672
1653
 
1673
1654
        tree.set_root (&get_template());
1674
1655
 
1675
 
        xml_path = dir;
1676
 
        xml_path += template_name;
1677
 
        xml_path += _template_suffix;
 
1656
        xml_path = Glib::build_filename(dir, template_name + _template_suffix);
1678
1657
 
1679
1658
        ifstream in(xml_path.c_str());
1680
1659
        
1696
1675
int
1697
1676
Session::rename_template (string old_name, string new_name) 
1698
1677
{
1699
 
        string old_path = template_dir() + old_name + _template_suffix;
1700
 
        string new_path = template_dir() + new_name + _template_suffix;
 
1678
        string old_path = Glib::build_filename(template_dir(), old_name + _template_suffix);
 
1679
        string new_path = Glib::build_filename(template_dir(), new_name + _template_suffix);
1701
1680
 
1702
1681
        return rename (old_path.c_str(), new_path.c_str());
1703
1682
}
1705
1684
int
1706
1685
Session::delete_template (string name) 
1707
1686
{
1708
 
        string template_path = template_dir();
1709
 
        template_path += name;
1710
 
        template_path += _template_suffix;
 
1687
        string template_path = Glib::build_filename(template_dir(), name + _template_suffix);
1711
1688
 
1712
1689
        return remove (template_path.c_str());
1713
1690
}
1751
1728
        
1752
1729
        /* Ensure that the sounds directory exists */
1753
1730
        
1754
 
        result = path;
1755
 
        result += '/';
1756
 
        result += sound_dir_name;
 
1731
        result = Glib::build_filename(path, sound_dir_name);
1757
1732
        
1758
1733
        if (g_mkdir_with_parents (result.c_str(), 0775)) {
1759
1734
                error << string_compose(_("cannot create sounds directory \"%1\"; ignored"), result) << endmsg;
1760
1735
                return -1;
1761
1736
        }
1762
1737
 
1763
 
        dead = path;
1764
 
        dead += '/';
1765
 
        dead += dead_sound_dir_name;
 
1738
        dead = Glib::build_filename(path, dead_sound_dir_name);
1766
1739
        
1767
1740
        if (g_mkdir_with_parents (dead.c_str(), 0775)) {
1768
1741
                error << string_compose(_("cannot create dead sounds directory \"%1\"; ignored"), dead) << endmsg;
1769
1742
                return -1;
1770
1743
        }
1771
1744
 
1772
 
        peak = path;
1773
 
        peak += '/';
1774
 
        peak += peak_dir_name;
 
1745
        peak = Glib::build_filename(path, peak_dir_name);
1775
1746
        
1776
1747
        if (g_mkdir_with_parents (peak.c_str(), 0775)) {
1777
1748
                error << string_compose(_("cannot create peak file directory \"%1\"; ignored"), peak) << endmsg;
2013
1984
{
2014
1985
        string res;
2015
1986
        string full;
 
1987
        vector<string> parts;
2016
1988
 
2017
1989
        if (with_path) {
2018
1990
                res = _path;
2020
1992
                full = _path;
2021
1993
        }
2022
1994
 
2023
 
        res += interchange_dir_name;
2024
 
        res += '/';
2025
 
        res += legalize_for_path (_name);
2026
 
        res += '/';
2027
 
        res += sound_dir_name;
 
1995
        parts.push_back(interchange_dir_name);
 
1996
        parts.push_back(legalize_for_path (_name));
 
1997
        parts.push_back(sound_dir_name);
2028
1998
 
 
1999
        res += Glib::build_filename(parts);
2029
2000
        if (with_path) {
2030
2001
                full = res;
2031
2002
        } else {
2064
2035
string
2065
2036
Session::peak_dir () const
2066
2037
{
2067
 
        string res = _path;
2068
 
        res += peak_dir_name;
2069
 
        res += '/';
2070
 
        return res;
 
2038
        return Glib::build_filename (_path, peak_dir_name);
2071
2039
}
2072
2040
        
2073
2041
string
2074
2042
Session::automation_dir () const
2075
2043
{
2076
 
        string res = _path;
2077
 
        res += "automation/";
2078
 
        return res;
 
2044
        return Glib::build_filename (_path, "automation");
2079
2045
}
2080
2046
 
2081
2047
string
2082
2048
Session::analysis_dir () const
2083
2049
{
2084
 
        string res = _path;
2085
 
        res += "analysis/";
2086
 
        return res;
 
2050
        return Glib::build_filename (_path, "analysis");
2087
2051
}
2088
2052
 
2089
2053
string
2090
2054
Session::template_dir ()
2091
2055
{
2092
 
        string path = get_user_ardour_path();
2093
 
        path += "templates/";
2094
 
 
2095
 
        return path;
 
2056
        return Glib::build_filename (get_user_ardour_path(), "templates");
2096
2057
}
2097
2058
 
2098
2059
string
2099
2060
Session::export_dir () const
2100
2061
{
2101
 
        string res = _path;
2102
 
        res += export_dir_name;
2103
 
        res += '/';
2104
 
        return res;
 
2062
        return Glib::build_filename (_path, export_dir_name);
2105
2063
}
2106
2064
 
2107
2065
string
2515
2473
int
2516
2474
Session::read_favorite_dirs (FavoriteDirs & favs)
2517
2475
{
2518
 
        string path = get_user_ardour_path();
2519
 
        path += "/favorite_dirs";
 
2476
        Glib::ustring path = Glib::build_filename (get_user_ardour_path(), "favorite_dirs");
2520
2477
 
2521
2478
        ifstream fav (path.c_str());
2522
2479
 
2550
2507
int
2551
2508
Session::write_favorite_dirs (FavoriteDirs & favs)
2552
2509
{
2553
 
        string path = get_user_ardour_path();
2554
 
        path += "/favorite_dirs";
 
2510
        Glib::ustring path = Glib::build_filename (get_user_ardour_path(), "favorite_dirs");
2555
2511
 
2556
2512
        ofstream fav (path.c_str());
2557
2513