I agree with you there, snm. It would have been better if the url and "file:" keywords would create any missing folders in the path they are given. But since they don't, changing the existing behavior would, as I described, break existing code. That should always be avoided since someone that didn't notice such a change in the release notes or forgets that, somewhere in their projects, there's some code that depends on the existing behavior, they would have no idea why their program suddenly is doing things it never did before.
The idea is good, but the timing is wrong to implement it now, particularly as it is just an ease-of-use change. Better to make another easy way to do the same thing, like expanding "create folder" to make more than one at a time. So that...
...would do the same as...
Code: Select all
set itemdel to "/"
repeat for each item thefolder in "C:/this/is/a/test"
put thefolder & "/" after thepath
create folder thepath
end repeat
Then you could replace your proposed...
Code: Select all
put "C:/this/is/my/data.txt" into myfile
put mydata into url ("file:" & myfile)
...with just two extra lines...
Code: Select all
put "C:/this/is/my/data.txt" into myfile
set itemdel to "/"
create folder (item 1 to -2 of myfile)
put mydata into url ("file:" & myfile)
...instead of five extra lines...
Code: Select all
put "C:/this/is/my/data.txt" into myfile
set itemdel to "/"
repeat for each item thefolder in (item 1 to -2 of myfile)
put thefolder & "/" after thepath
create folder thepath
end repeat
put mydata into url ("file:" & myfile)
And that change won't break existing code since calling "create folder" with more than one folder does nothing at all right now. It doesn't even create the first folder. There's nothing to break.