+WIMLIBAPI int
+wimlib_set_error_file(FILE *fp)
+{
+#ifdef ENABLE_ERROR_MESSAGES
+ if (wimlib_owns_error_file)
+ fclose(wimlib_error_file);
+ wimlib_error_file = fp;
+ wimlib_print_errors = (fp != NULL);
+ wimlib_owns_error_file = false;
+ return 0;
+#else
+ return WIMLIB_ERR_UNSUPPORTED;
+#endif
+}
+
+WIMLIBAPI int
+wimlib_set_error_file_by_name(const tchar *path)
+{
+#ifdef ENABLE_ERROR_MESSAGES
+ FILE *fp;
+
+ fp = tfopen(path, "a");
+ if (!fp)
+ return WIMLIB_ERR_OPEN;
+ wimlib_set_error_file(fp);
+ wimlib_owns_error_file = true;
+ return 0;
+#else
+ return WIMLIB_ERR_UNSUPPORTED;
+#endif
+}
+