Better handling of rootfs default

This commit is contained in:
elicn
2022-05-31 23:03:42 +03:00
committed by Eli
parent e01ce973ba
commit 59953e10e6
2 changed files with 4 additions and 7 deletions
+2 -5
View File
@@ -30,7 +30,7 @@ class Qiling(QlCoreHooks, QlCoreStructs):
def __init__(
self,
argv: Sequence[str] = None,
rootfs: str = None,
rootfs: str = r'.',
env: MutableMapping[AnyStr, AnyStr] = {},
code: bytes = None,
ostype: Union[str, QL_OS] = None,
@@ -100,10 +100,7 @@ class Qiling(QlCoreHooks, QlCoreStructs):
################
# rootfs setup #
################
if rootfs is None:
rootfs = '.'
elif not os.path.exists(rootfs):
if not os.path.exists(rootfs):
raise QlErrorFileNotFound(f'Target rootfs not found: "{rootfs}"')
self._rootfs = rootfs
+2 -2
View File
@@ -187,7 +187,7 @@ if __name__ == '__main__':
code_parser.add_argument('--thumb', action='store_true', help='specify thumb mode for ARM')
code_parser.add_argument('--endian', choices=('little', 'big'), default='little', help='specify endianess for bi-endian archs')
code_parser.add_argument('--os', required=True, choices=os_map)
code_parser.add_argument('--rootfs', help='emulated root filesystem, that is where all libraries reside')
code_parser.add_argument('--rootfs', default='.', help='emulated root filesystem, that is where all libraries reside')
code_parser.add_argument('--format', choices=('asm', 'hex', 'bin'), default='bin', help='input file format')
# set "examples" subcommand
@@ -223,7 +223,7 @@ if __name__ == '__main__':
handle_examples(parser)
# ql file setup
if options.subcommand == 'run':
elif options.subcommand == 'run':
ql = handle_run(options)
# ql code setup