2 Skelton for retropc emulator
3 Author : Takeda.Toshiya
4 Port to Qt : K.Ohta <whatisthis.sowhat _at_ gmail.com>
7 [ win32 main ] -> [ agar main ]
18 #include "menu_flags.h"
20 extern std::string cpp_homedir;
21 extern std::string cpp_confdir;
22 extern std::string my_procname;
23 extern std::string sRssDir;
25 void get_long_full_path_name(_TCHAR* src, _TCHAR* dst)
33 if(dst != NULL) dst[0] = '\0';
42 if(cpp_homedir == "") {
43 r_path = mdir.currentPath();
45 r_path = QString::fromStdString(cpp_homedir);
47 //s = AG_ShortFilename(src);
48 r_path = r_path + QString::fromStdString(my_procname);
49 r_path = r_path + delim;
52 // if(s != NULL) ss = s;
54 if(dst != NULL) strncpy(dst, r_path.toUtf8().constData(),
55 strlen(r_path.toUtf8().constData()) >= PATH_MAX ? PATH_MAX : strlen(r_path.toUtf8().constData()));
59 _TCHAR* get_parent_dir(_TCHAR* file)
67 char *p = (char *)file;
68 if(file == NULL) return NULL;
69 for(ptr = strlen(p) - 1; ptr >= 0; ptr--) {
70 if(p[ptr] == delim) break;
72 if(ptr >= 0) for(ptr = ptr + 1; ptr < strlen(p); ptr++) p[ptr] = '\0';
76 void get_short_filename(_TCHAR *dst, _TCHAR *file, int maxlen)
79 if((dst == NULL) || (file == NULL)) return;
85 for(i = strlen(file) - 1; i <= 0; i--) {
86 if(file[i] == delim) break;
88 if(i >= (strlen(file) - 1)) {
92 l = strlen(file) - i + 1;
93 if(l >= maxlen) l = maxlen;
94 strncpy(dst, &file[i + 1], l);
98 extern int MainLoop(int argc, char *argv[]);
101 * This is main for Qt.
103 int main(int argc, char *argv[])
113 nErrorCode = MainLoop(argc, argv);
116 #if defined(Q_OS_WIN)
117 int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)