#1
|
||||
|
||||
[EventScripter] writeFile() method improvements
Hi,
If "append" is false and file already exists, then writeFile does nothing and leave the file as it is. I understand it is by design but could we add a parameter to force overwriting existing file in this case? |
#2
|
||||
|
||||
Why not just use the 'deleteFile(Path,recursive)' method to delete the file first?
I don't think that a new method is required if you can achieve the same with existing 'deleteFile' method. I also have doubts about the syntax. New method to force overwrite. Does it have more priority than append? what if user calls append and overwrite, should it append or overwrite?
__________________
JD-Dev & Server-Admin |
#3
|
||||
|
||||
May an overwrite(path) method that create or overwrite if file exists?
Yes, one can still use delete() method. In fact, I expected that append=false overwrite existing file so I just need to control, dynamically change that variable when needed. |
#4
|
||||
|
||||
Why not simply check for file existance and then delete if required or use append=true?
__________________
JD-Dev & Server-Admin |
#5
|
||||
|
||||
Yes, we can do that. It just add more check than simply use append to actually append or overwrite.
|
#6
|
||||
|
||||
Code:
if (append){ write(append) }else{ delete(..) write() }
__________________
JD-Dev & Server-Admin |
Thread Tools | |
Display Modes | |
|
|