Skip to content

Commit

Permalink
Display an error if home path is not valid for a subvolume
Browse files Browse the repository at this point in the history
  • Loading branch information
dgdavid committed Feb 6, 2019
1 parent 743ed3f commit 4cc6622
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/include/users/dialogs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,7 @@ def EditUserDialog(what)
no_skel = Convert.to_boolean(UI.QueryWidget(Id(:skel), :Value))
mode = Convert.to_string(UI.QueryWidget(Id(:mode), :Value))
end

if Ops.add(Builtins.findlastof(new_home, "/"), 1) ==
Builtins.size(new_home)
new_home = Builtins.substring(
Expand All @@ -1379,6 +1380,17 @@ def EditUserDialog(what)
)
end

# Check if is a valid path when creating a Btfs subvolume
if btrfs_subvolume && !valid_btrfs_path?(new_home)
Report.Error(
_("Given path is not a valid Btrfs location.\n\n" \
"Choose another path for the home directory\n" \
"or uncheck the 'Btrfs subvolume' option.")
)
focus_tab.call(current, :home)
next
end

if do_not_edit
new_home = home
new_shell = shell
Expand Down

0 comments on commit 4cc6622

Please sign in to comment.