Skip to content
This repository was archived by the owner on May 9, 2020. It is now read-only.

Commit b2989a3

Browse files
committed
Improve temporary cuefile
1 parent d73d180 commit b2989a3

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

split2flac

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,11 @@ update_pattern () {
291291

292292
# splits a file
293293
split_file () {
294-
TMPCUE="${HOME}/.split2flac_XXXXX.cue"
294+
TMPCUE="$(mktemp).cue"
295295
FILE="$1"
296296

297+
trap 'rm -f $TMPCUE &>/dev/null' EXIT
298+
297299
if [ ! -r "${FILE}" ]; then
298300
emsg "Can not read the file\n"
299301
return 1
@@ -326,10 +328,8 @@ split_file () {
326328

327329
if [ -n "${CUESHEET}" ]; then
328330
$msg "${cP}Found internal cue sheet$cZ\n"
329-
TMPCUE=$(mktemp "${TMPCUE}")
330331
CUE="${TMPCUE}"
331332
echo "${CUESHEET}" > "${CUE}"
332-
TMPCUE="${HOME}/.split2flac_XXXXX.cue"
333333

334334
if [ $? -ne 0 ]; then
335335
emsg "Unable to save internal cue sheet\n"
@@ -348,6 +348,8 @@ split_file () {
348348
return 1
349349
fi
350350

351+
$msg "${cG}Cue sheet :$cZ ${CUE}\n"
352+
351353
# cue sheet charset
352354
[ -z "${CHARSET}" ] && CHARSET="utf-8" || $msg "${cG}Cue charset : $cP${CHARSET} -> utf-8$cZ\n"
353355

@@ -382,7 +384,6 @@ split_file () {
382384
fi
383385

384386
# save converted cue sheet
385-
TMPCUE=$(mktemp "${TMPCUE}")
386387
CUE="${TMPCUE}"
387388
echo "${CUESHEET}" > "${CUE}"
388389

@@ -416,7 +417,6 @@ split_file () {
416417
fi
417418
fi
418419

419-
$msg "${cG}Cue sheet :$cZ ${CUE}\n"
420420
$msg "${cG}Cover image :$cZ ${PIC:-not set}\n"
421421

422422
# file removal warning
@@ -694,7 +694,6 @@ split_file () {
694694
fi
695695

696696
rm -f "${TMPPIC}"
697-
rm -f "${TMPCUE}"
698697

699698
if [ ${DRY} -ne 1 -a ${REMOVE} -eq 1 ]; then
700699
YEP="n"

0 commit comments

Comments
 (0)