Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2019-08-20 00:00:00Z and 2019-08-21 00:00:00Z
Avatar
@ChillerDragon should be a one line fix
Avatar
Does Storage()->RemoveFile(...) work with folders?
14:32
I would say no but im not sure
14:40
we use the remove function from POSIX standard, so see man 3p remove
Avatar
files and folder on linux are the same right
Avatar
If path does not name a directory, remove(path) shall be equivalent to unlink(path). If path names a directory, remove(path) shall be equivalent to rmdir(path).
14:40
So only empty directories will be deleted, not recursively.
Avatar
hm
14:41
ok thx
Avatar
@Ryozuki not exactly. unlink() on a directory is not guaranteed to work by POSIX
Avatar
hmm
14:59
it didn't delete an empty directory
Avatar
this should work if the tmp directory is empty right?
15:19
Avatar
This fixes an issue I noticed with replays. When you change the map but you stay on the same server, the temporary demo file used to save replays isn't deleted since the map name has changed. This adds a way that will delete every single demo file in tmp/ directory under demos/replays, so that no more temporary files are kept.
Avatar
@archimede67 true, i can reproduce.
16:30
actually no, works for me
16:30
i just accidentally did it twice and then the second one fails of course
16:31
Windows might not implement remove C99-compliantly
16:32
Yep: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/remove-wremove?view=vs-2019
EACCES to indicate that the path specifies a read-only file, specifies a directory
16:33
Feel free to add a RemoveDirectory function
16:35
sorry, actually C89/99 only define that remove can remove files, no mention of directories
Avatar
and while you're at it, use unlink directly so that RemoveFile only removes files, not dirs
Avatar
so i should use remove in RemoveDirectory and unlink in RemoveFile?
Avatar
[quakenet] deen BOT 2019-08-20 21:17:46Z
rmdir in RemoveDirectory
Avatar
ah yes thank you
Avatar
lol i'm actually dumb
Exported 29 message(s)