Daniel Mejia
02/04/2022, 11:25 PMcanWrite
property works, or maybe this is a bug.bdw429s
02/04/2022, 11:29 PMDaniel Mejia
02/04/2022, 11:30 PMcanWrite: whether the file has write permission
.bdw429s
02/04/2022, 11:30 PMbdw429s
02/04/2022, 11:30 PMDaniel Mejia
02/04/2022, 11:30 PMcanWrite
property. I know its open - but thats exactly what I want to find out.Daniel Mejia
02/04/2022, 11:32 PMDavid Buck
02/05/2022, 9:26 PMfileOpen()
? You don't need to do that to use getFileInfo()
. In fact, you should probably check the canWrite
property before you open it (assuming you do intend to write to it). Unfortunately, if it didn't get closed for some reason (via fileClose()
), then it may now be stuck in an open state, making it impossible to interact with until you reboot the server.Daniel Mejia
02/07/2022, 4:10 PMDavid Buck
02/07/2022, 5:53 PMAdam Cameron
At this point I wish cfml errors had specific error codesOr - wild wild idea here - actually had exception types. Now there's a crazy idea that no-one has ever thought of before. 😐
Adam Cameron
canWrite
value would be agnostic to the underlying reason why a file might not be writable, be it perms or it being already locked open?
If you can write to it, you can write to it. Isn't that what you care about?
Or is it returning true
even if the file is in use by another process, or something?Adam Cameron
try {
// open it for writing
// write to it
} catch () {
// deal with it
} finally {
try {
// close it
} catch () {
// deal with _that_
}
}
Job done?David Buck
02/07/2022, 8:03 PMgetFileInfo()
does just check for write permission like Daniel said (actually, I'm not even sure it checks permissions-- it may just look at the readonly property).Adam Cameron
Adam Cameron
Adam Cameron
Adam Cameron
Daniel Mejia
02/08/2022, 3:08 AMDavid Buck
02/08/2022, 3:54 PM