Merge branch 'master' into cairocanvas
[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 "ardour/libardour_visibility.h"
26
27 namespace ARDOUR {
28
29 class LIBARDOUR_API SessionDirectory
30 {
31 public:
32
33         /**
34          * @param session_path An absolute path to a session directory.
35          */
36         SessionDirectory (const std::string& 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 std::string 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 std::string sound_path () const;
58
59         /**
60          * @return the absolute path to the directory in which
61          * the session stores audio files for Ardour 2.X.
62          *
63          * If the session is an older session with an existing
64          * "sounds" directory then it will return a path to that
65          * directory otherwise it will return the new location
66          * of root_path()/interchange/session_name/audiofiles
67          */
68         const std::string sound_path_2X () const;
69
70         /**
71          * @return the absolute path to the directory in which
72          * the session stores MIDI files, ie
73          * root_path()/interchange/session_name/midifiles
74          */
75         const std::string midi_path () const;
76
77         /**
78          * @return the absolute path to the directory in which
79          * the session stores MIDNAM patch files, ie
80          * root_path()/interchange/session_name/patchfiles
81          */
82         const std::string midi_patch_path () const;
83
84         /**
85          * @return The absolute path to the directory in which all
86          * peak files are stored for a session.
87          */
88         const std::string peak_path () const;
89
90         /**
91          * @return The absolute path to the directory in which all
92          * video files are stored for a session.
93          */
94         const std::string video_path () const;
95
96         /**
97          * @return The absolute path to the directory that source
98          * files are moved to when they are no longer part of the
99          * session.
100          */
101         const std::string dead_path () const;
102
103         /**
104          * @return The absolute path to the directory that audio
105          * files are created in by default when exporting.
106          */
107         const std::string export_path () const;
108
109         /**
110          * @return true if session directory and all the required
111          * subdirectories exist.
112          */
113         bool is_valid () const;
114
115         /**
116          * Create the session directory and all the subdirectories.
117          *
118          * @return true If a new session directory and subdirectories were
119          * created, otherwise false.
120          *
121          * @post is_valid ()
122          */
123         bool create ();
124
125         /**
126          * @return The path to the directory under which source directories
127          * are created for different source types.
128          * i.e root_path()/interchange/session_name
129          */
130         const std::string sources_root() const;
131
132         /**
133          * @return The path to the directory under which source directories
134          * are created for different source types in Ardour 2.X
135          * i.e root_path()/interchange/session_name
136          */
137         const std::string sources_root_2X() const;
138
139 private:
140
141         /**
142          * @return The path to the old style sound directory.
143          * It isn't created by create().
144          */
145         const std::string old_sound_path () const;
146
147         /**
148          * @return a vector containing the fullpath of all subdirectories.
149          */
150         const std::vector<std::string> sub_directories () const;
151
152         /// The path to the root of the session directory.
153         std::string m_root_path;
154 };
155
156 } // namespace ARDOUR
157
158 #endif