Making use of command -move in xorriso-tcltk
This commit is contained in:
parent
5be71159ed
commit
1f19cd39ce
@ -110,6 +110,11 @@ Options:
|
||||
The log lines will be appended. Path "-" means stderr.
|
||||
--script_log_all_commands
|
||||
With logging of commands log non-essential commands too.
|
||||
--use_command_move
|
||||
Use xorriso command -move for the "Move to: button
|
||||
if xorriso version is >= 1.2.8
|
||||
--use_command_mv
|
||||
Use xorriso command -mv for the "Move to:" button.
|
||||
|
||||
If neither --stdio nor --named_pipes is given, then this script
|
||||
will try to locate itself in the filesystem and start a xorriso
|
||||
|
@ -19,7 +19,7 @@
|
||||
# And, well, a graphical widget set would be nice.
|
||||
|
||||
|
||||
set own_version "1.2.7"
|
||||
set own_version "1.2.8"
|
||||
|
||||
# Minimum version of xorriso to be used as backend process.
|
||||
# Older versions of xorriso do not offer commands -msg_op and -launch_frontend
|
||||
@ -73,6 +73,11 @@ proc print_usage {argv0} {
|
||||
puts stderr " The log lines will be appended. Path \"-\" means stderr."
|
||||
puts stderr " --script_log_all_commands"
|
||||
puts stderr " With logging of commands log non-essential commands too."
|
||||
puts stderr " --use_command_move"
|
||||
puts stderr " Use xorriso command -move for the \"Move to:\" button"
|
||||
puts stderr " if xorriso version is >= 1.2.8"
|
||||
puts stderr " --use_command_mv"
|
||||
puts stderr " Use xorriso command -mv for the \"Move to:\" button."
|
||||
puts stderr ""
|
||||
puts stderr "If neither --stdio nor --named_pipes is given, then this script"
|
||||
puts stderr "will try to locate itself in the filesystem and start a xorriso"
|
||||
@ -139,6 +144,9 @@ set bulk_parse_num_texts ""
|
||||
# This may be expected when xorriso is being shut down by this frontend.
|
||||
set expect_broken_pipes "0"
|
||||
|
||||
# Whether to use command -move rather than -mv. Possible since xorriso-1.2.8.
|
||||
set use_command_move 1
|
||||
|
||||
|
||||
# Local copies of xorriso state
|
||||
|
||||
@ -781,6 +789,7 @@ proc localfs_filetype {path} {
|
||||
#
|
||||
proc check_xorriso_version {} {
|
||||
global sieve_ret result_list pre_msglist xorriso_version min_xorriso_version
|
||||
global use_command_move
|
||||
global reply_conn
|
||||
|
||||
set version "0.0.0 (= unknown)"
|
||||
@ -808,6 +817,9 @@ proc check_xorriso_version {} {
|
||||
"red" "embedded"
|
||||
central_exit 2
|
||||
}
|
||||
if {$xorriso_version < "1.2.8"} {
|
||||
set use_command_move 0
|
||||
}
|
||||
set_display_msg $disp_en_mem
|
||||
}
|
||||
|
||||
@ -1615,7 +1627,7 @@ proc isodir_up {} {
|
||||
proc isomanip_mv {} {
|
||||
global .isolist
|
||||
global isomanip_move_target isolist_names isodir_is_pwd isodir_adr
|
||||
global isodir_return_name
|
||||
global isodir_return_name use_command_move
|
||||
|
||||
if {$isomanip_move_target == ""} {
|
||||
xorriso_tcltk_errmsg \
|
||||
@ -1664,7 +1676,7 @@ proc isomanip_mv {} {
|
||||
set name_ftype [isofs_filetype $name]
|
||||
|
||||
# Ask for confirmation if overwriting is about to happen
|
||||
if {$target_ftype == "d"} {
|
||||
if {$target_ftype == "d" && $use_command_move == 0} {
|
||||
set eff_target [combine_dir_and_name $target $name]
|
||||
set eff_target_ftype [isofs_filetype $eff_target]
|
||||
} else {
|
||||
@ -1673,11 +1685,17 @@ proc isomanip_mv {} {
|
||||
}
|
||||
if {[handle_overwriting "isofs" $eff_target $eff_target_ftype \
|
||||
"isofs" $name $name_ftype $multi_source \
|
||||
"" ""] == "0"} {
|
||||
"" "" "replace"] == "0"} {
|
||||
if {$multi_source == 0} { return "" }
|
||||
continue
|
||||
}
|
||||
send_loggable_cmd "-mv [make_text_shellsafe $name] [make_text_shellsafe $target] --"
|
||||
if {$use_command_move == 0} {
|
||||
send_loggable_cmd \
|
||||
"-mv [make_text_shellsafe $name] [make_text_shellsafe $target] --"
|
||||
} else {
|
||||
send_loggable_cmd \
|
||||
"-move [make_text_shellsafe $name] [make_text_shellsafe $target] --"
|
||||
}
|
||||
}
|
||||
|
||||
if {[llength $selected] == 1} {
|
||||
@ -2032,7 +2050,7 @@ proc refresh_avail {} {
|
||||
#
|
||||
proc handle_overwriting {target_fs target target_ftype
|
||||
source_fs source source_ftype multi_source
|
||||
selected_adr selected_ftype} {
|
||||
selected_adr selected_ftype dir_action} {
|
||||
global overwrite_iso_files overwrite_iso_dirs overwrite_disk_files
|
||||
|
||||
if {$target_fs == "localfs"} {
|
||||
@ -2064,6 +2082,16 @@ proc handle_overwriting {target_fs target target_ftype
|
||||
if {$target_ftype != ""} {
|
||||
if {$target_ftype == "d"} {
|
||||
if {$source_ftype == "d"} {
|
||||
if {$dir_action == "replace"} {
|
||||
if {$overwrite_iso_dirs != 1} {
|
||||
xorriso_tcltk_errmsg "xorriso-tcltk : SORRY : You would have to enable \"Overwrite $overwrite_fs dirs\" for\n[make_text_shellsafe $target]"
|
||||
return "0"
|
||||
}
|
||||
if {[$what_window \
|
||||
"Really replace existing $to_fs directory\n\n[make_text_shellsafe $target]\n\nby $from_fs directory\n[make_text_shellsafe $source]\n?"] \
|
||||
!= 1} { return "0" }
|
||||
return "1"
|
||||
}
|
||||
if {[$what_window \
|
||||
"Really merge existing $to_fs directory\n\n[make_text_shellsafe $target]\n\nwith $from_fs directory\n[make_text_shellsafe $source]\n?"] \
|
||||
!= 1} { return "0" }
|
||||
@ -2142,7 +2170,7 @@ proc insert_from {} {
|
||||
reset_yesno_to_all
|
||||
if {[handle_overwriting "isofs" $target $target_ftype \
|
||||
"localfs" $insert_from_adr $source_ftype 0 \
|
||||
$selected_adr $selected_ftype] == "0"} {
|
||||
$selected_adr $selected_ftype "merge"] == "0"} {
|
||||
return ""
|
||||
}
|
||||
|
||||
@ -2238,7 +2266,7 @@ proc extract_to {} {
|
||||
set source_ftype [isofs_filetype $i]
|
||||
if {[handle_overwriting "localfs" $target $target_ftype \
|
||||
"isofs" $i $source_ftype $multi_source \
|
||||
"" ""] == 0} {
|
||||
"" "" "merge"] == 0} {
|
||||
continue
|
||||
}
|
||||
send_loggable_cmd \
|
||||
@ -4321,7 +4349,7 @@ proc set_overwriting_label {} {
|
||||
# The central storage for help texts.
|
||||
#
|
||||
proc tell_helptext {what} {
|
||||
global own_version argv0 bwidget_version
|
||||
global own_version argv0 bwidget_version use_command_move
|
||||
|
||||
if {$what == "Help"} {
|
||||
return \
|
||||
@ -4536,7 +4564,12 @@ and the frontend is still waiting for its reply messages."
|
||||
if {$what == "Command:"} {
|
||||
return \
|
||||
"The \"Command:\" field can be used to send commands to xorriso.
|
||||
See the manual page of xorriso for its concepts and commands."
|
||||
See the manual page of xorriso for its concepts and commands.
|
||||
|
||||
Normally the other GUI elements will emit xorriso commands for you.
|
||||
This input field is presented only to make accessible those features
|
||||
of xorriso which are not covered by the GUI. Use the \"Refresh disp\"
|
||||
button to update the display after you have manually transmitted commands."
|
||||
}
|
||||
if {$what == "Script/Log"} {
|
||||
return \
|
||||
@ -4998,7 +5031,7 @@ overwritten in the ISO image. See xorriso command -overwrite \"nondir\".
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
The \"Overwrite ISO dirs\" switch controls whether it is allowed to replace
|
||||
an ISO directory by a non-directory file. See xorriso command -overwrite \"on\".
|
||||
an ISO directory by a another file. See xorriso command -overwrite \"on\".
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
@ -5157,6 +5190,7 @@ is written via \"Write ISO session\". Nevertheless they will stay present
|
||||
in earlier sessions beginning from the session where they were inserted."
|
||||
}
|
||||
if {$what == "Move to:"} {
|
||||
if {$use_command_move == 0} {
|
||||
return \
|
||||
"The \"Move to:\" button uses command -mv to move each of the selected
|
||||
items to the address that is given by the text field right to the button.
|
||||
@ -5165,6 +5199,11 @@ If this address points to an existing ISO directory, then the items will
|
||||
be moved underneath that directory and keep their leaf names.
|
||||
Else there may be only one selected item which will be renamed to the
|
||||
given address."
|
||||
} else {
|
||||
return \
|
||||
"The \"Move to:\" button uses command -move to rename each of the selected
|
||||
items to the address that is given by the text field right to the button."
|
||||
}
|
||||
}
|
||||
if {$what == "Make dir"} {
|
||||
return \
|
||||
@ -5739,7 +5778,7 @@ proc escape_newline {text backslash_too} {
|
||||
proc setup_by_args {argv0 argv} {
|
||||
global cmd_pipe_adr reply_pipe_adr main_window_geometry click_to_focus
|
||||
global have_bwidget cmd_conn reply_conn geometry stdout stdin
|
||||
global osirrox_allowed cmd_logging_all
|
||||
global osirrox_allowed cmd_logging_all use_command_move
|
||||
|
||||
# wish normally eats the -geometry option and puts the result into $geometry
|
||||
catch {set main_window_geometry $geometry}
|
||||
@ -5817,6 +5856,14 @@ proc setup_by_args {argv0 argv} {
|
||||
set ok "1"
|
||||
set have_bwidget "-1"
|
||||
}
|
||||
if {$opt == "--use_command_move"} {
|
||||
set ok "1"
|
||||
set use_command_move 1
|
||||
}
|
||||
if {$opt == "--use_command_mv"} {
|
||||
set ok "1"
|
||||
set use_command_move 0
|
||||
}
|
||||
if {$ok == 0} {
|
||||
puts stderr "$argv0 : Unknown option '$opt'"
|
||||
print_usage $argv0
|
||||
|
Loading…
Reference in New Issue
Block a user