|
|
| version 1.6, 2004/06/20 09:36:37 | version 1.9, 2011/07/21 06:40:18 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include <sys/stat.h> | #include <sys/stat.h> |
| #include <time.h> | #include <time.h> |
| #if defined(WIN32) && defined(OSLANG_EUC) | |
| #include "codecnv.h" | |
| #endif | |
| #include "dosio.h" | #include "dosio.h" |
| #if defined(WIN32) | #if defined(WIN32) |
| #include <direct.h> | #include <direct.h> |
| Line 27 FILEH file_open(const char *path) { | Line 30 FILEH file_open(const char *path) { |
| #if defined(WIN32) && defined(OSLANG_EUC) | #if defined(WIN32) && defined(OSLANG_EUC) |
| char sjis[MAX_PATH]; | char sjis[MAX_PATH]; |
| codecnv_euc2sjis(sjis, sizeof(sjis), path, (UINT)-1); | codecnv_euctosjis(sjis, sizeof(sjis), path, (UINT)-1); |
| return(fopen(sjis, "rb+")); | return(fopen(sjis, "rb+")); |
| #else | #else |
| return(fopen(path, "rb+")); | return(fopen(path, "rb+")); |
| Line 38 FILEH file_open_rb(const char *path) { | Line 41 FILEH file_open_rb(const char *path) { |
| #if defined(WIN32) && defined(OSLANG_EUC) | #if defined(WIN32) && defined(OSLANG_EUC) |
| char sjis[MAX_PATH]; | char sjis[MAX_PATH]; |
| codecnv_euc2sjis(sjis, sizeof(sjis), path, (UINT)-1); | codecnv_euctosjis(sjis, sizeof(sjis), path, (UINT)-1); |
| return(fopen(sjis, "rb+")); | return(fopen(sjis, "rb+")); |
| #else | #else |
| return(fopen(path, "rb+")); | return(fopen(path, "rb+")); |
| Line 49 FILEH file_create(const char *path) { | Line 52 FILEH file_create(const char *path) { |
| #if defined(WIN32) && defined(OSLANG_EUC) | #if defined(WIN32) && defined(OSLANG_EUC) |
| char sjis[MAX_PATH]; | char sjis[MAX_PATH]; |
| codecnv_euc2sjis(sjis, sizeof(sjis), path, (UINT)-1); | codecnv_euctosjis(sjis, sizeof(sjis), path, (UINT)-1); |
| return(fopen(sjis, "wb+")); | return(fopen(sjis, "wb+")); |
| #else | #else |
| return(fopen(path, "wb+")); | return(fopen(path, "wb+")); |
| Line 248 static BOOL setflist(WIN32_FIND_DATA *w3 | Line 251 static BOOL setflist(WIN32_FIND_DATA *w3 |
| fli->caps |= FLICAPS_DATE | FLICAPS_TIME; | fli->caps |= FLICAPS_DATE | FLICAPS_TIME; |
| } | } |
| #if defined(OSLANG_EUC) | #if defined(OSLANG_EUC) |
| codecnv_sjis2euc(fli->path, sizeof(fli->path), | codecnv_sjistoeuc(fli->path, sizeof(fli->path), |
| w32fd->cFileName, (UINT)-1); | w32fd->cFileName, (UINT)-1); |
| #else | #else |
| file_cpyname(fli->path, w32fd->cFileName, sizeof(fli->path)); | file_cpyname(fli->path, w32fd->cFileName, sizeof(fli->path)); |
| Line 342 struct stat sb; | Line 345 struct stat sb; |
| fli->size = 0; | fli->size = 0; |
| fli->attr = 0; | fli->attr = 0; |
| } | } |
| mileuc_ncpy(fli->path, de->d_name, sizeof(fli->path)); | milstr_ncpy(fli->path, de->d_name, sizeof(fli->path)); |
| } | } |
| return(SUCCESS); | return(SUCCESS); |
| } | } |
| Line 373 void file_catname(char *path, const char | Line 376 void file_catname(char *path, const char |
| } | } |
| } | } |
| char *file_getname(char *path) { | char *file_getname(const char *path) { |
| char *ret; | const char *ret; |
| int csize; | int csize; |
| ret = path; | ret = path; |
| Line 385 char *file_getname(char *path) { | Line 388 char *file_getname(char *path) { |
| } | } |
| path += csize; | path += csize; |
| } | } |
| return(ret); | return((char *)ret); |
| } | } |
| void file_cutname(char *path) { | void file_cutname(char *path) { |
| Line 396 void file_cutname(char *path) { | Line 399 void file_cutname(char *path) { |
| *p = '\0'; | *p = '\0'; |
| } | } |
| char *file_getext(char *path) { | char *file_getext(const char *path) { |
| char *p; | const char *p; |
| char *q; | const char *q; |
| p = file_getname(path); | p = file_getname(path); |
| q = NULL; | q = NULL; |
| Line 412 char *file_getext(char *path) { | Line 415 char *file_getext(char *path) { |
| if (q == NULL) { | if (q == NULL) { |
| q = p; | q = p; |
| } | } |
| return(q); | return((char *)q); |
| } | } |
| void file_cutext(char *path) { | void file_cutext(char *path) { |