How do we check if a file is editable in PeopleCode? This was a question asked in ITToolbox forum.
We can do this easily using Java File class object.
We can do this easily using Java File class object.
&myFileToCheck = "C:\Temp\MYFILE.TXT";
Local JavaObject &file = CreateJavaObject("java.io.File", &myFileToCheck);
If &file.canWrite() Then
/*Normal processing*/
MessageBox(%MsgStyle_OK, "", 0, 0, "File is editable!!");
Else
/*Error processing*/
MessageBox(%MsgStyle_OK, "", 0, 0, "File is Read Only!!");
End-If;
No comments:
Post a Comment