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

Commit 5e91177

Browse files
committed
Improve temporary cuefile
1 parent d73d180 commit 5e91177

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

split2flac

Lines changed: 3 additions & 5 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"
@@ -382,7 +382,6 @@ split_file () {
382382
fi
383383

384384
# save converted cue sheet
385-
TMPCUE=$(mktemp "${TMPCUE}")
386385
CUE="${TMPCUE}"
387386
echo "${CUESHEET}" > "${CUE}"
388387

@@ -694,7 +693,6 @@ split_file () {
694693
fi
695694

696695
rm -f "${TMPPIC}"
697-
rm -f "${TMPCUE}"
698696

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

0 commit comments

Comments
 (0)