Merge branch 'master' into windows
[ardour.git] / libs / pbd / test / test_common.cc
1 /*
2     Copyright (C) 2011 Tim Mayberry
3
4     This program is free software; you can redistribute it and/or modify it
5     under the terms of the GNU General Public License as published by the Free
6     Software Foundation; either version 2 of the License, or (at your option)
7     any later version.
8
9     This program is distributed in the hope that it will be useful, but WITHOUT
10     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12     for more details.
13
14     You should have received a copy of the GNU General Public License along
15     with this program; if not, write to the Free Software Foundation, Inc.,
16     675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19 #include <glibmm/miscutils.h>
20
21 #include "test_common.h"
22
23 /**
24  * This allows tests to find the data files they require by looking
25  * in an installed location on windows or by setting an environment variable
26  * on unix.
27  */
28 PBD::Searchpath
29 test_search_path ()
30 {
31 #ifdef PLATFORM_WINDOWS
32         std::string wsp(g_win32_get_package_installation_directory_of_module(NULL));
33         return Glib::build_filename (wsp,  "pbd_testdata");
34 #else
35         return Glib::getenv("PBD_TEST_PATH");
36 #endif
37 }