From 335bc9ef43132fff04326735e93a9bc6a4fbb127 Mon Sep 17 00:00:00 2001 From: Dmitry Leskov Date: Sat, 15 Jun 2013 11:08:18 +0700 Subject: [PATCH] Force removal of temporary WAV files. Fixes #2 It turned out that flac.exe propagates the readonly attribute to the output file. Fortunately, FileSystemObject.DeleteFile() has an optinal argument 'force' that overrides that attribute. Version changed to 0.92. --- AddFLACs.js | 6 ++++-- build.bat | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/AddFLACs.js b/AddFLACs.js index 38093ab..b8fbc16 100644 --- a/AddFLACs.js +++ b/AddFLACs.js @@ -1,7 +1,7 @@ // // AddFLACs.js - add FLAC audio files to iTunes media library // -// Version: 0.91 +// Version: 0.92 // // Refer to the file COPYING.MIT for licensing conditions. // @@ -271,8 +271,10 @@ function Traverse(folder) { if (fso.FileExists(tempTrackPath)) fso.DeleteFile(tempTrackPath) } + // #2: it turned out that flac.exe preserves the readonly attribute, + // so it is necessary to force removal log("Deleting temporary WAV file") - fso.DeleteFile(tempWAVPath) + fso.DeleteFile(tempWAVPath, true) } } var subfolders = new Enumerator(folder.SubFolders) diff --git a/build.bat b/build.bat index c7b911a..07f5eae 100644 --- a/build.bat +++ b/build.bat @@ -5,5 +5,5 @@ call src\utf8to16\build.bat "C:\Program Files (x86)\Pandoc\bin\pandoc.exe" -s --html5 -o dist\README.html README.md for %%i in (AddFLACs.bat AddFLACs.js COPYING.MIT COPYING.GPL bin\flac.exe bin\metaflac.exe) do copy %%i dist cd dist -if exist ..\AddFLACs-0.91.zip del ..\AddFLACs-0.91.zip -zip ..\AddFLACs-0.91.zip * +if exist ..\AddFLACs-0.92.zip del ..\AddFLACs-0.92.zip +zip ..\AddFLACs-0.92.zip *