Deleting file using unrealscript

Discussions about Coding and Scripting
User avatar
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Deleting file using unrealscript

Post by PrinceOfFunky »

Same procedre of writing a file, just the temp file must be empty and the final file must be the one you want to delete. Apparently it cannot delete folders.

Code: Select all

local StatLogFile file;
	file = Spawn(class'StatLogFile');
	//tmp file name.
	file.StatLogFile = "";
	//final file name.
	file.StatLogFinal = "FILE DIR TO DELETE GOES HERE";
"Your stuff is known to be buggy and unfinished/not properly tested"
Posts: 577
Joined: Tue Jun 20, 2017 1:00 pm
Personal rank: ⚋⚊⚌☰⚞⌖⚟☰⚌⚊⚋

Re: Deleting file using unrealscript

Post by nogardilaref »

Whoa... that's quite counter-intuitive.
By not assigning a temporary file, one would assume that the worst case scenario would be for the file to not be created at all, and hence never touching what already existed.

But no.... it seems that it will actually delete even an existing file... perhaps because it assumes the final one to also be the temporary one in that case, and what it actually does is to delete the "temporary" one at the end?
Does it make a difference if you actually try to write some data to it? (probably not, which would probably prove my assumption here)