diff --git a/aegisub/src/utils.cpp b/aegisub/src/utils.cpp
index a36d084ea499b8211545f61d9bc17f9692eea459..c5b6fe25159e379e9351710f0bc2752d206bcdc1 100644
--- a/aegisub/src/utils.cpp
+++ b/aegisub/src/utils.cpp
@@ -378,7 +378,12 @@ class cache_cleaner : public wxThread {
 				break;
 
 			int64_t fsize = i->second.GetSize().GetValue();
-			if (!wxRemoveFile(i->second.GetFullPath())) {
+#ifdef __WXMSW__
+			int res = wxRemove(i->second.GetFullPath());
+#else
+			int res = unlink(i->second.GetFullPath().fn_str());
+#endif
+			if (res) {
 				LOG_D("utils/clean_cache") << "failed to remove file " << STD_STR(i->second.GetFullPath());
 				continue;
 			}