bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47058: 28.0.50; Dired Z: insert-directory: Reading directory: No suc


From: Michalis V.
Subject: bug#47058: 28.0.50; Dired Z: insert-directory: Reading directory: No such file or directory, CrossLine_linux_x86
Date: Tue, 21 Sep 2021 23:11:22 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Gregory Heytings <gregory@heytings.org> writes:

>>> Something like:
>>>
>>> TMP=$(mktemp -d ./XXXXXXXX)
>>> tar -C $TMP -x -z -f $FILE
>>> if (($(ls $TMP | wc -l) == 1))
>>> then
>>>    mv $TMP/* .
>>>    rmdir $TMP
>>> else
>>>    mv $TMP $(basename $FILE .tar.gz)
>>> fi
>>
>> Wouldn't that remove the files that are in the directory but not in the
>> archive?
>>
>
> No, it does what I explained above:
>
> If all files in the tar file are under one directory (e.g. emacs-27.2.tar.gz
> whose files are all in a emacs-27.2 directory), the files will be in that
> directory.
>
> If on the contrary the tar file is "broken" and its files are under multiple
> directories or not in a directory (say foobar.tar.gz with three files "/foo",
> "/bar" and "/baz"), the files will be put in a directory "foobar".

hi Gregory,

i've gone down that road with make-temp-file until i realized that i
cannot trust that the temporary-file-directory (usually /tmp/ in linux)
has enough space to allow such action (e.g. it might be a small
ramdisk).
But in your example i see you create the temporary dir in the current
one where the archive also resides, correct?

and i just realized that this is possible in elisp:

(let ((temporary-file-directory "/home/mvar/"))
  (make-temp-file "boing-" t))

without altering the global var. I think this is quite feasible and will
give it a try, thank you!


Michalis





reply via email to

[Prev in Thread] Current Thread [Next in Thread]