1
0
Fork 0
forked from glenux/mfm

fix: rename global.mount_point to avoid misunderstanding

This commit is contained in:
Glenn Y. Rolland 2023-11-24 10:49:55 +01:00
parent 84230a6828
commit 32fea233d1
2 changed files with 7 additions and 7 deletions

View file

@ -90,13 +90,13 @@ module GX
root = Models::RootConfig.from_yaml(file_patched)
global_mount_point = root.global.mount_point
raise Models::InvalidMountpointError.new("Invalid global mount point") if global_mount_point.nil?
mount_point_base_safe = root.global.mount_point_base
raise Models::InvalidMountpointError.new("Invalid global mount point") if mount_point_base_safe.nil?
root.filesystems.each do |selected_filesystem|
if !selected_filesystem.mount_point?
selected_filesystem.mount_point =
File.join(global_mount_point, selected_filesystem.mounted_name)
File.join(mount_point_base_safe, selected_filesystem.mounted_name)
end
end
@root = root

View file

@ -14,16 +14,16 @@ module GX::Models
include YAML::Serializable
include YAML::Serializable::Strict
@[YAML::Field(key: "mount_point")]
getter mount_point : String?
@[YAML::Field(key: "mount_point_base")]
getter mount_point_base : String?
def after_initialize()
raise InvalidEnvironmentError.new("Home directory not found") if !ENV["HOME"]?
home_dir = ENV["HOME"]
# Set default mountpoint from global if none defined
if @mount_point.nil? || @mount_point.try &.empty?
@mount_point = File.join(home_dir, "mnt")
if @mount_point_base.nil? || @mount_point_base.try &.empty?
@mount_point_base = File.join(home_dir, "mnt")
end
end
end