Implemented native function to delete a file.
#
# Copyright 2004-2008 Jean Privat <jean@pryen.org>
# Copyright 2008 Floréal Morandat <morandat@lirmm.fr>
+# Copyright 2008 Jean-Sébastien Gélinas <calestar@gmail.com>
#
# This file is free software, which comes along with NIT. This software is
# distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
meth file_stat: FileStat do return to_cstring.file_stat
+ meth file_delete: Bool do return to_cstring.file_delete
+
meth strip_extension(ext: String): String
do
if has_suffix(ext) then
private meth file_exists: Bool is extern "string_NativeString_NativeString_file_exists_0"
private meth file_stat: FileStat is extern "string_NativeString_NativeString_file_stat_0"
private meth file_mkdir: Bool is extern "string_NativeString_NativeString_file_mkdir_0"
+ private meth file_delete: Bool is extern "string_NativeString_NativeString_file_delete_0"
end
universal FileStat
*
* Copyright 2004-2008 Jean Privat <jean@pryen.org>
* Copyright 2008 Floréal Morandat <morandat@lirmm.fr>
+ * Copyright 2008 Jean-Sébastien Gélinas <calestar@gmail.com>
*
* This file is free software, which comes along with NIT. This software is
* distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
return to_nit_file_stat(&buff);
return 0;
}
+
+extern int string_NativeString_NativeString_file_delete_0(char *f){
+ return (remove(f) == 0);
+}
*
* Copyright 2004-2008 Jean Privat <jean@pryen.org>
* Copyright 2008 Floréal Morandat <morandat@lirmm.fr>
+ * Copyright 2008 Jean-Sébastien Gélinas <calestar@gmail.com>
*
* This file is free software, which comes along with NIT. This software is
* distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
extern int string_NativeString_NativeString_file_exists_0(char *f);
extern void *string_NativeString_NativeString_file_stat_0(char *f);
extern void *file_NativeFile_NativeFile_file_stat_0(FILE *f);
+extern int string_NativeString_NativeString_file_delete_0(char *f);
#define file_NativeFile_NativeFile_io_read_2(p, b, l) fread((b), 1, (l), (FILE*)(p))
#define file_NativeFile_NativeFile_io_write_2(p, b, l) fwrite((b), 1, (l), (FILE*)(p))