git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@345 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-15 18:55:41 +00:00
parent f71ab6184b
commit 39c09b1fb7
11 changed files with 292 additions and 264 deletions

View File

@@ -38,6 +38,14 @@ enum MwALIGNMENT {
*/
#define MwDEFAULT 0x0fffffff
/*!
* %brief Directory entry type
*/
enum {
MwDIRECTORY_FILE = 0,
MwDIRECTORY_DIRECTORY
};
/*!
* %brief Icon mask
*/

View File

@@ -42,7 +42,6 @@ MWDECL char* MwIconQuestion[];
*/
MWDECL char* MwIconWarning[];
#ifdef __cplusplus
}
#endif

View File

@@ -23,6 +23,7 @@
#include <dlfcn.h>
#include <signal.h>
#include <dirent.h>
#include <sys/stat.h>
#endif
#ifndef M_PI

View File

@@ -139,7 +139,7 @@ struct _MwSizeHints {
struct _MwDirectoryEntry {
char* name;
unsigned long attribute;
int type;
};
#define MwCursorDataHeight 16

View File

@@ -14,6 +14,7 @@ typedef struct dir {
#else
typedef struct dir {
DIR* dir;
char* base;
} dir_t;
#endif
@@ -35,6 +36,8 @@ void* MwDirectoryOpen(const char* path) {
free(dir);
return NULL;
}
dir->base = malloc(strlen(path) + 1);
strcpy(dir->base, path);
#endif
return dir;
@@ -46,6 +49,7 @@ void MwDirectoryClose(void* handle) {
FindClose(dir->hFind);
#else
closedir(dir->dir);
free(dir->base);
#endif
free(handle);
}
@@ -62,14 +66,36 @@ MwDirectoryEntry* MwDirectoryRead(void* handle) {
}
entry->name = malloc(strlen(dir->ffd.cFileName) + 1);
strcpy(entry->name, dir->ffd.cFileName);
if(dir->ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
entry->type = MwDIRECTORY_DIRECTORY;
} else {
entry->type = MwDIRECTORY_FILE;
}
#else
struct dirent* d;
struct stat s;
char* p;
if((d = readdir(dir->dir)) == NULL) {
free(entry);
return NULL;
}
entry->name = malloc(strlen(d->d_name) + 1);
strcpy(entry->name, d->d_name);
p = malloc(strlen(dir->base) + 1 + strlen(d->d_name) + 1);
strcpy(p, dir->base);
strcat(p, "/");
strcat(p, d->d_name);
stat(p, &s);
if(S_ISDIR(s.st_mode)) {
entry->type = MwDIRECTORY_DIRECTORY;
} else {
entry->type = MwDIRECTORY_FILE;
}
free(p);
#endif
return entry;

View File

@@ -45,5 +45,4 @@ char *MwIconError[] = {
"..ooo.@@ .X.....o.@@@@ ...@@ ",
" .oo.@ .XXXXooo.@@@ @@@ ",
" ...@@ .ooooo.@@@ ",
" @@@@ .....@@ "
};
" @@@@ .....@@ "};

View File

@@ -41,5 +41,4 @@ char *MwIconInfo[] = {
" ",
" ",
" ",
" "
};
" "};

View File

@@ -43,5 +43,4 @@ char *MwIconNews[] = {
" ..... ",
" ",
" ",
" "
};
" "};

View File

@@ -45,5 +45,4 @@ char *MwIconNote[] = {
" .......+O+O+O.. ",
" ..+OO..+O+.. ",
" ...+..... ",
" ..... "
};
" ..... "};

View File

@@ -43,5 +43,4 @@ char *MwIconQuestion[] = {
" XXXXooOOO ",
" XoooOOOO ",
" OOOOOO ",
" OOOO "
};
" OOOO "};

View File

@@ -43,5 +43,4 @@ char *MwIconWarning[] = {
" .............................oo",
" ...........................ooo",
" ooooooooooooooooooooooooooo ",
" "
};
" "};