Extra folder with fwWrite();

Can someone who has ‘quite a bit more’ experiance with action writing than me clarify the following:

I am using ‘custom action-markup’ in an action to contain code that is written to a file (2 files actually) which are then uploaded by FW to the same directory of the page the action is applied to, the last few lines of code are as follows:

outFile.fwWrite(outputcode);
outFile.fwClose();
fwParameters[theScript].fwSpecify(outFile);

var fileExists = fwFindFile(fwParameters[theScript].fwValue);

if (fileExists){
   fwDeleteFile(fwParameters[theScript].fwValue);
}

// Pass the name over to a variable before clearing the parameter
var tempParam = fwParameters[theScript].fwValue;
fwParameters[theScript].fwClear();

// Return the file name Freeway has used for the file
return tempParam;

I find that Freeway creates a folder just outside the site folder which it stores these files in ‘with the same name as the site file but ending in an underslash’, then fwDeleteFile() will delete those files… is it common practice to leave the folder there or does it need to be deleted?

I see that the folder seems to be left there by other actions that create files and then have them placed in the same directory as the page those actions are applied to but just want to make sure this is the way I should be doing this.

Thanks
Mike


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This is the normal thing to have happen, and I don’t believe you can remove that folder (except maybe with AppleScript). The folder will be used by any other Actions in the same document that generate files. Interestingly, if you don’t save the file before publishing (or use a template that sets up a site folder on creation) then these files get made in the Application Support folder.

Walter


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Oh yes, but the folder below the site folder still seems to gets created.

The content of one of the two files that gets created doesn’t change so if there are several pages that have the action applied then there is only one copy made in the site folder. The other ‘config’ file has several copies of the file created if the config settings in the action palette are changed on each page the same action is applied to… but fwDeleteFile() doesn’t delete the config file it creates in this ‘storage’ folder but the file which has only one copy is deleted.

The copies in the ‘storage’ folder are generated with the original names given to them in the action while the multiple copies that FW makes from these are altered with an a, b, c etc. ‘as we know!’ so I tried changed the contents of fwDeleteFile() to the original file names within the same action and see then that ‘both’ the files get deleted from the ‘storage’ folder. Then FW does not then generate the multiple copies anymore… I guess because the storage folder copies have been deleted but the interesting thing is that Freeway doesn’t seem to generate the ‘storage’ copies again for each time the action has been applied, nor does it return an error when trying to generate the files and can’t!

Am I making any sense here?

so I guess it is a case of using the following code:

var fileExists = fwFindFile(fwParameters[theScript].fwValue);

if (fileExists){
   fwDeleteFile(fwParameters[theScript].fwValue);
}

and if the config file isn’t deleted then it isn’t deleted.

Mike


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options