a better fix for CUE/TOC string escaping: if the text is not Latin-1 already, reject...
[ardour.git] / libs / ardour / ardour / session_directory.h
1 /*
2         Copyright (C) 2007 Tim Mayberry
3
4         This program is free software; you can redistribute it and/or modify
5         it under the terms of the GNU General Public License as published by
6         the Free Software Foundation; either version 2 of the License, or
7         (at your option) any later version.
8
9         This program is distributed in the hope that it will be useful,
10         but WITHOUT ANY WARRANTY; without even the implied warranty of
11         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12         GNU General Public License for more details.
13
14         You should have received a copy of the GNU General Public License
15         along with this program; if not, write to the Free Software
16         Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19 #ifndef __ardour_session_directory_h__
20 #define __ardour_session_directory_h__
21
22 #include <string>
23 #include <vector>
24
25 #include "pbd/filesystem.h"
26
27 namespace ARDOUR {
28
29 class SessionDirectory
30 {
31 public:
32
33         /**
34          * @param session_path An absolute path to a session directory.
35          */
36         SessionDirectory (const PBD::sys::path& session_path);
37
38         /**
39          * Change the root path of this SessionDirectory object
40          */
41         SessionDirectory& operator= (const std::string& path);
42
43         /**
44          * @return the absolute path to the root directory of the session
45          */
46         const PBD::sys::path root_path() const { return m_root_path; }
47
48         /**
49          * @return the absolute path to the directory in which
50          * the session stores audio files.
51          *
52          * If the session is an older session with an existing
53          * "sounds" directory then it will return a path to that
54          * directory otherwise it will return the new location
55          * of root_path()/interchange/session_name/audiofiles
56          */
57         const PBD::sys::path sound_path () const;
58
59         /**
60          * @return the absolute path to the directory in which
61          * the session stores MIDI files, ie
62          * root_path()/interchange/session_name/midifiles
63          */
64         const PBD::sys::path midi_path () const;
65
66         /**
67          * @return the absolute path to the directory in which
68          * the session stores MIDNAM patch files, ie
69          * root_path()/interchange/session_name/patchfiles
70          */
71         const PBD::sys::path midi_patch_path () const;
72
73         /**
74          * @return The absolute path to the directory in which all
75          * peak files are stored for a session.
76          */
77         const PBD::sys::path peak_path () const;
78
79         /**
80          * @return The absolute path to the directory that source
81          * files are moved to when they are no longer part of the
82          * session.
83          */
84         const PBD::sys::path dead_path () const;
85
86         /**
87          * @return The absolute path to the directory that audio
88          * files are created in by default when exporting.
89          */
90         const PBD::sys::path export_path () const;
91
92         /**
93          * @return true if session directory and all the required
94          * subdirectories exist.
95          */
96         bool is_valid () const;
97
98         /**
99          * Create the session directory and all the subdirectories.
100          *
101          * @throw PBD::sys::filesystem_error if the directories were
102          * not able to be created.
103          *
104          * @return true If a new session directory was created, otherwise
105          * (if it already existed) false.
106          *
107          * @post is_valid ()
108          */
109         bool create ();
110
111         /**
112          * @return The path to the directory under which source directories
113          * are created for different source types.
114          * i.e root_path()/interchange/session_name
115          */
116         const PBD::sys::path sources_root() const;
117
118 private:
119
120         /**
121          * @return The path to the old style sound directory.
122          * It isn't created by create().
123          */
124         const PBD::sys::path old_sound_path () const;
125
126         /**
127          * @return a vector containing the fullpath of all subdirectories.
128          */
129         const std::vector<PBD::sys::path> sub_directories () const;
130
131         /// The path to the root of the session directory.
132         PBD::sys::path m_root_path;
133 };
134
135 } // namespace ARDOUR
136
137 #endif