deja-dup-team team mailing list archive
-
deja-dup-team team
-
Mailing list archive
-
Message #00525
[Merge] lp:~mterry/deja-dup/support-user-var into lp:deja-dup
Michael Terry has proposed merging lp:~mterry/deja-dup/support-user-var into lp:deja-dup.
Requested reviews:
Robert Bruce Park (robru)
Related bugs:
Bug #1086097 in Déjà Dup: "Replace $USER in gsettings with user name"
https://bugs.launchpad.net/deja-dup/+bug/1086097
For more details, see:
https://code.launchpad.net/~mterry/deja-dup/support-user-var/+merge/137893
Replace "$USER" in include/exclude paths with username.
--
https://code.launchpad.net/~mterry/deja-dup/support-user-var/+merge/137893
Your team Déjà Dup Developers is subscribed to branch lp:deja-dup.
=== modified file 'common/DirHandling.vala'
--- common/DirHandling.vala 2012-04-13 20:46:19 +0000
+++ common/DirHandling.vala 2012-12-04 16:10:32 +0000
@@ -49,10 +49,15 @@
s = get_trash_path();
else if (s == "$VIDEOS")
s = Environment.get_user_special_dir(UserDirectory.VIDEOS);
- else if (Uri.parse_scheme(s) == null && !Path.is_absolute(s))
- s = Path.build_filename(Environment.get_home_dir(), s);
- else
- return File.parse_name(s);
+ else {
+ // Some variables can be placed inside a larger path, so replace those
+ s = s.replace("$USER", Environment.get_user_name());
+
+ if (Uri.parse_scheme(s) == null && !Path.is_absolute(s))
+ s = Path.build_filename(Environment.get_home_dir(), s);
+ else
+ return File.parse_name(s);
+ }
if (s != null)
return File.new_for_path(s);
=== modified file 'tests/unit/unit-tests.vala'
--- tests/unit/unit-tests.vala 2012-04-30 00:33:47 +0000
+++ tests/unit/unit-tests.vala 2012-12-04 16:10:32 +0000
@@ -37,6 +37,8 @@
parse_one_dir("$PICTURES", Environment.get_user_special_dir(UserDirectory.PICTURES));
parse_one_dir("$PUBLIC_SHARE", Environment.get_user_special_dir(UserDirectory.PUBLIC_SHARE));
parse_one_dir("$TEMPLATES", Environment.get_user_special_dir(UserDirectory.TEMPLATES));
+ parse_one_dir("/backup/$USER", Path.build_filename("/backup", Environment.get_user_name()));
+ parse_one_dir("backup/$USER", Path.build_filename(Environment.get_home_dir(), "backup", Environment.get_user_name()));
parse_one_dir("$VIDEOS", Environment.get_user_special_dir(UserDirectory.VIDEOS));
parse_one_dir("VIDEOS", Path.build_filename(Environment.get_home_dir(), "VIDEOS"));
parse_one_dir("/VIDEOS", "/VIDEOS");
Follow ups