MoneroWalletOps: preclude use of cfg.outdir

This commit is contained in:
The MMGen Project 2024-03-03 09:59:02 +00:00
commit 2c2c07d964
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
7 changed files with 12 additions and 9 deletions

View file

@ -68,7 +68,8 @@ class AddrFile(MMGenObject):
fn = None,
binary = False,
desc = None,
ask_overwrite = True):
ask_overwrite = True,
outdir = None):
from .fileutil import write_data_to_file
write_data_to_file(
cfg = self.cfg,
@ -77,7 +78,8 @@ class AddrFile(MMGenObject):
desc = desc or self.desc,
ask_tty = self.parent.has_keys and not self.cfg.quiet,
binary = binary,
ask_overwrite = ask_overwrite)
ask_overwrite = ask_overwrite,
outdir = outdir)
def make_label(self):
p = self.parent

View file

@ -627,7 +627,6 @@ class Autosign:
'wallet_dir': str(self.wallet_dir),
'autosign': True,
'autosign_mountpoint': str(self.mountpoint),
'outdir': str(self.xmr_dir), # required by vkal.write()
'offline': True,
'passwd_file': str(self.keyfile),
})

View file

@ -239,6 +239,7 @@ class Config(Lockable):
('label','keep_label'),
('tx_id','info'),
('tx_id','terse_info'),
('autosign','outdir'),
)
_cfg_file_opts = (

View file

@ -1 +1 @@
February 2024
March 2024

View file

@ -1 +1 @@
14.1.dev15
14.1.dev16

View file

@ -161,6 +161,7 @@ def write_data_to_file(
quiet = False,
binary = False,
ignore_opt_outdir = False,
outdir = None,
check_data = False,
cmp_data = None):
@ -218,8 +219,8 @@ def write_data_to_file(
os.write(1,data if isinstance(data,bytes) else data.encode())
def do_file(outfile,ask_write_prompt):
if cfg.outdir and not ignore_opt_outdir and not os.path.isabs(outfile):
outfile = make_full_path(cfg.outdir,outfile)
if (outdir or (cfg.outdir and not ignore_opt_outdir)) and not os.path.isabs(outfile):
outfile = make_full_path(outdir or cfg.outdir, outfile)
if ask_write:
if not ask_write_prompt:

View file

@ -1217,13 +1217,13 @@ class MoneroWalletOps:
vkf = vkal.file
# before writing viewkey-address file, shred any old ones in the directory:
for f in Path(self.cfg.outdir or '.').iterdir():
for f in Path(self.asi.xmr_dir).iterdir():
if f.name.endswith(vkf.ext):
from .fileutil import shred_file
msg(f"\nShredding old viewkey-address file '{f}'")
shred_file( f, verbose=self.cfg.verbose )
vkf.write() # write file to self.cfg.outdir
vkf.write(outdir=self.asi.xmr_dir)
class restore(create):
wallet_offline = True