Implemented wrapper for @open (#344)
Fixed #336 Implemented a wrapper for placing the path to a file in quotes. This corrects the problem of handling paths containing spaces in C programs such as `DGEN`, since the space is the argument delimiter. The wrapper should have the name `<app>_open`. Wrapper trims the `_open` postfix and launches the `<app>`. Reviewed-on: KolibriOS/kolibrios#344 Reviewed-by: Ivan B <dunkaist@noreply.localhost> Reviewed-by: Max Logaev <maxlogaev@proton.me> Co-authored-by: Matou <mathieubotros@gmail.com> Co-committed-by: Matou <mathieubotros@gmail.com>
This commit is contained in:
1 parent
4c359e42ce
commit
e9e9ebb4c8
4 files changed
+69
-2
No files matched your search
@@ -0,0 +1,3 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
tup.include("../../use_fasm.lua")
|
||||
tup.rule("wrap_open.asm", FASM .. " %f %o " .. tup.getconfig("KPACK_CMD"), "wrap_open")
|
||||
@@ -0,0 +1,63 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2013-2024. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License. ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; wraps command line arguments in quotes and launches a target.
|
||||
include 'KOSfuncs.inc'
|
||||
include 'macros.inc'
|
||||
|
||||
org 0x0
|
||||
use32
|
||||
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
dd start
|
||||
dd i_end
|
||||
dd m_end
|
||||
dd m_end
|
||||
dd path
|
||||
dd target_path
|
||||
|
||||
start:
|
||||
mov edi, target_path
|
||||
or ecx, -1
|
||||
xor al, al
|
||||
repne scasb
|
||||
|
||||
sub edi, 6
|
||||
mov byte [edi], 0
|
||||
|
||||
cmp byte [path], 0
|
||||
je .launch
|
||||
|
||||
mov byte [q_path], '"'
|
||||
|
||||
mov edi, path
|
||||
or ecx, -1
|
||||
xor al, al
|
||||
repne scasb
|
||||
|
||||
mov word [edi-1], '"'
|
||||
|
||||
mov dword [fi + 8], q_path
|
||||
|
||||
.launch:
|
||||
mcall SF_FILE, fi
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
|
||||
fi:
|
||||
dd SSF_START_APP, 0, 0, 0, 0
|
||||
db 0
|
||||
dd target_path
|
||||
|
||||
i_end:
|
||||
|
||||
q_path rb 1
|
||||
path rb 255
|
||||
|
||||
target_path rb 1024
|
||||
|
||||
m_end:
|
||||
Reference in new issue
Block a user