33 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
34 Components.utils.import(
"resource://app/jsmodules/ArrayConverter.jsm");
37 .getService(
Ci.fuelIApplication);
46 dump(
"WF is watching " +
file.path +
"\n");
47 Application.prefs.setValue(
"songbird.watch_folder.path",
file.path);
49 Application.prefs.setValue(
"songbird.watch_folder.enable", !!
file);
51 Application.prefs.get(
"songbird.watch_folder.sessionguid").reset();
60 log(
"\n\n\nWatchFolder Job - " + jobName +
" job progress - " +
61 job.progress +
"/" + job.total +
", " + job.errorCount +
" failed. " +
62 "Status " + job.statusText +
" (" + job.status +
"), Title: " + job.titleText);
63 var errorEnumerator = job.getErrorMessages();
64 while (errorEnumerator.hasMore()) {
65 log(
"WatchFolder Job " + jobName +
" - error: " + errorEnumerator.getNext());
78 folder.copyTo(tempFolder, tempName);
79 folder = tempFolder.clone();
80 folder.append(tempName);
92 var folder = optionalLocation ? optionalLocation :
getTempFolder();
93 file.copyTo(folder, tempName);
94 file = folder.clone();
95 file.append(tempName);
109 gTempFolder = Components.classes[
"@mozilla.org/file/directory_service;1"]
110 .getService(Components.interfaces.nsIProperties)
111 .get(
"TmpD", Components.interfaces.nsIFile);
112 gTempFolder.append(
"songbird_watchfolder_tests" + Math.random() +
".tmp");
113 gTempFolder.createUnique(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777);
123 if (gTempFolder && gTempFolder.exists()) {
124 gTempFolder.remove(
true);
126 log(
"\n\n\nWatch Folder Test may not have performed cleanup. Temp files may exist.\n\n\n");
function assertNotEqual(aExpected, aActual, aMessage)
function setWatchFolder(file)
function getCopyOfFile(file, tempName, optionalLocation)
function reportJobProgress(job, jobName)
function assertEqual(aExpected, aActual, aMessage)
function removeTempFolder()
function getCopyOfFolder(folder, tempName)