9 #ifndef LWFTYPE_INSTALL
10 #define LWFTYPE_INSTALL "Install" // installation directory, not defined by LW
15 #ifdef LWPP_PLATFORM_WIN
16 const char fSep =
'\\';
17 #elif defined(LWPP_PLATFORM_OSX_CFM)
18 const char fSep =
':';
20 #elif defined(LWPP_PLATFORM_OSX_UB)
21 const char fSep =
'/';
23 #error no valid Platform
25 extern const char *
fSeps;
33 std::string return_dir;
38 DirInfo (
const char *dirtype = 0) : dirType(dirtype)
40 if ((dirtype == 0) || (*dirtype == 0)) dirType = LWFTYPE_CONTENT;
58 const char *
stripPath(
const char *fileName);
81 const char *
GetType(
const char *filetype)
const
94 virtual bool Post(
void) = 0;
104 OSFileRequest (
const int reqType = FREQ_LOAD,
char *title =
"",
105 const char *fileType =
"",
const char *ext =
"",
const char *baseName =
"",
106 const char *path =
"",
const char *_baseDirType = 0,
int bufLen = 1024);
110 virtual bool Post(
void);
115 #ifdef LWPP_PLATFORM_WIN
116 #elif defined(LWPP_PLATFORM_OSX_CFM)
117 NavDialogCreationOptions dialogOptions;
120 NavReplyRecord replyRecord;
121 std::string temp_path;
122 #elif defined(LWPP_PLATFORM_OSX_UB)
124 #error No OS specifice file requester!
137 LWFileReqLocal frloc;
150 const char *fileType =
"",
const char *baseName =
"",
151 const char *path =
"",
const char *_baseDirType = 0,
152 int (*pickName) (
void) = 0,
int bufLen = 1024)
155 frloc.reqType = reqType;
156 frloc.bufLen = bufLen;
159 frloc.fileType = fileType;
160 frloc.path =
new char[bufLen];
161 frloc.baseName =
new char[bufLen];
162 frloc.fullName =
new char[bufLen];
163 strcpy (frloc.path, path);
164 strcpy (frloc.baseName, baseName);
165 frloc.pickName = pickName;
170 delete[] frloc.baseName;
171 delete[] frloc.fullName;
188 return frloc.fullName;
200 strcpy (frloc.baseName, name.c_str());
227 std::string fileName;
228 std::string relativePath;
229 std::string fullName;
234 void buildFullName();
236 void splitFileName();
238 bool setRelativeName(
const char *relName);
239 void setExtension(
const char *ext);
240 static std::string extractExtension(
const char *source);
247 FileName (
const char *_baseDir = LWFTYPE_CONTENT,
bool base =
false) : baseDir(_baseDir), valid(false), useBase(base)
251 FileName (
const std::string name,
bool base =
false) : baseDir(LWFTYPE_CONTENT), valid(false), useBase(base)
270 if (!valid) buildFullName();
273 dout <<
"FileName::getFullName() - " << fullName << std::endl;
275 return fullName.c_str();
279 if (!valid) buildFullName();
312 setExtension(extension);
316 return std::string(extractExtension(fileName.c_str()));
324 setExtension(ext.c_str());
330 static bool Exists(
const std::string &name);
339 std::string
trim(
const std::string& s,
const char *ws=
" \t\r");
342 std::string
makeRelativeName(
const std::string basePath,
const std::string absFileName);
344 std::string
makeAbsoluteName(
const std::string basePath,
const std::string relFileName);
354 std::string
makeAbsoluteName(
const std::string basePath,
const std::string relFileName);
363 Stat(
const std::string fName);
378 #endif // FILE_REQUEST_H