filepath.h

Go to the documentation of this file.
00001 /*
00002  *      File/path utility implemented with Win32 API.
00003  *
00004  *      Copyright (c) 2005-2007 Naoaki Okazaki
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  * 
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00019  *
00020  */
00021 
00022 /* $Id: filepath.h 328 2007-02-10 17:50:11Z nyaochi $ */
00023 
00024 #ifndef __FILEPATHUTIL_H__
00025 #define __FILEPATHUTIL_H__
00026 
00027 #include <time.h>
00028 #include <pmplib/ucs2char.h>
00029 
00030 #ifdef  FILEPATH_EXPORTS
00031 #define FILEPATHAPI     __declspec(dllexport)
00032 #else
00033 #define FILEPATHAPI
00034 #endif
00035 
00036 
00037 #ifdef  __cplusplus
00038 extern "C" {
00039 #endif/*__cplusplus*/
00040 
00069 FILEPATHAPI ucs2char_t* filepath_addslash(ucs2char_t* path);
00070 
00081 FILEPATHAPI ucs2char_t* filepath_removeslash(ucs2char_t* path);
00082 
00092 FILEPATHAPI const ucs2char_t* filepath_combinepath(ucs2char_t* dst, size_t size, const ucs2char_t* path, const ucs2char_t* file);
00093 
00101 FILEPATHAPI void filepath_strippath(ucs2char_t* path);
00102 
00111 FILEPATHAPI const ucs2char_t* filepath_skippath(const ucs2char_t* path);
00112 
00119 FILEPATHAPI void filepath_remove_filespec(ucs2char_t* path);
00120 
00131 FILEPATHAPI const ucs2char_t* filepath_skiproot(const ucs2char_t* path, const ucs2char_t* root);
00132 
00145 FILEPATHAPI const ucs2char_t* filepath_changeroot(const ucs2char_t* path, const ucs2char_t* root);
00146 
00155 FILEPATHAPI const ucs2char_t* filepath_skipadirectory(const ucs2char_t* path);
00156 
00163 FILEPATHAPI void filepath_add_extension(ucs2char_t* path, const ucs2char_t* ext);
00164 
00171 FILEPATHAPI void filepath_remove_extension(ucs2char_t* path);
00172 
00182 FILEPATHAPI int filepath_relative_to_absolute(ucs2char_t* absolute, const ucs2char_t* base, const ucs2char_t* relative);
00183 
00191 FILEPATHAPI int filepath_path_canonicalize(ucs2char_t* dst, const ucs2char_t* src);
00192 
00204 FILEPATHAPI int filepath_encode(ucs2char_t* path);
00205 
00217 FILEPATHAPI int filepath_decode(ucs2char_t* path);
00218 
00238 typedef int (*filepath_findfile_callback)(void *instance, const ucs2char_t* found_path, const ucs2char_t* found_file);
00239 
00252 FILEPATHAPI int find_file(const ucs2char_t* path, int recursive, filepath_findfile_callback callback, void *instance);
00253 
00260 FILEPATHAPI int filepath_file_exists(const ucs2char_t* path);
00261 
00269 FILEPATHAPI int filepath_hasext(const ucs2char_t* filename, const ucs2char_t* ext);
00270 
00277 FILEPATHAPI int filepath_is_dir(const ucs2char_t *path);
00278 
00285 FILEPATHAPI int filepath_is_relative(const ucs2char_t* path);
00286 
00294 FILEPATHAPI int filepath_is_same_root(const ucs2char_t* path1, const ucs2char_t* path2);
00295 
00302 FILEPATHAPI time_t filepath_mtime(const ucs2char_t *filename);
00303 
00317 FILEPATHAPI int filepath_compare_lastupdate(const ucs2char_t* file1, const ucs2char_t* file2);
00318 
00325 FILEPATHAPI uint32_t filepath_size(const ucs2char_t *filename);
00326 
00333 FILEPATHAPI int filepath_removefile(const ucs2char_t* file);
00334 
00342 FILEPATHAPI int filepath_copyfile(const ucs2char_t* src, const ucs2char_t* dst);
00343 
00349 #ifdef  __cplusplus
00350 }
00351 #endif/*__cplusplus*/
00352 
00353 #endif/*__FILEPATHUTIL_H__*/