1
/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 2 -*- */
3
This file is part of Déjà Dup.
4
For copyright information, see AUTHORS.
6
Déjà Dup is free software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
11
Déjà Dup is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with Déjà Dup. If not, see <http://www.gnu.org/licenses/>.
24
public string get_trash_path()
26
return Path.build_filename(Environment.get_user_data_dir(), "Trash");
29
public File? parse_dir(string dir)
33
s = Environment.get_home_dir();
34
else if (s == "$DESKTOP")
35
s = Environment.get_user_special_dir(UserDirectory.DESKTOP);
36
else if (s == "$DOCUMENTS")
37
s = Environment.get_user_special_dir(UserDirectory.DOCUMENTS);
38
else if (s == "$DOWNLOAD")
39
s = Environment.get_user_special_dir(UserDirectory.DOWNLOAD);
40
else if (s == "$MUSIC")
41
s = Environment.get_user_special_dir(UserDirectory.MUSIC);
42
else if (s == "$PICTURES")
43
s = Environment.get_user_special_dir(UserDirectory.PICTURES);
44
else if (s == "$PUBLIC_SHARE")
45
s = Environment.get_user_special_dir(UserDirectory.PUBLIC_SHARE);
46
else if (s == "$TEMPLATES")
47
s = Environment.get_user_special_dir(UserDirectory.TEMPLATES);
48
else if (s == "$TRASH")
50
else if (s == "$VIDEOS")
51
s = Environment.get_user_special_dir(UserDirectory.VIDEOS);
52
else if (Uri.parse_scheme(s) == null && !Path.is_absolute(s))
53
s = Path.build_filename(Environment.get_home_dir(), s);
55
return File.parse_name(s);
58
return File.new_for_path(s);
63
public File[] parse_dir_list(string*[] dirs)
65
File[] rv = new File[0];
67
foreach (string s in dirs) {