[Modcplusplus-devel] (barbee-) apr_cplusplus/src/files cpp_anyfile.cpp
Brought to you by:
gr84b8,
johnksterling
|
From: Mod C. C. L. <mod...@so...> - 2002-02-23 21:14:17
|
Mod Cplusplus CVS committal
Author : barbee-
Project : apr_cplusplus
Module : src
Dir : apr_cplusplus/src/files
Modified Files:
cpp_anyfile.cpp
Log Message:
it's possible to get an apr_finfo_t where there is a name member
but no fname member. in this case, just slap name at the
end of the cwd.
===================================================================
RCS file: /cvsroot/modcplusplus/apr_cplusplus/src/files/cpp_anyfile.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- cpp_anyfile.cpp 23 Feb 2002 04:09:15 -0000 1.1
+++ cpp_anyfile.cpp 23 Feb 2002 21:14:17 -0000 1.2
@@ -1,3 +1,4 @@
+#include "apr_strings.h"
#include "cpp_exception.h"
#include "cpp_anyfile.h"
@@ -10,7 +11,17 @@
APRAnyFile::APRAnyFile(apr_pool_t *pPool, apr_finfo_t *pInfo) {
mPool = pPool;
mInfo = pInfo;
- mName = mInfo->fname;
+ if (mInfo->fname) {
+ mName = mInfo->fname;
+ } else {
+ /* it's possible to get an apr_finfo_t where there is a name member
+ * but no fname member. in this case, just slap name at the
+ * end of the cwd.
+ */
+ char *path = (char *)apr_pcalloc(mPool, sizeof(*path));
+ apr_filepath_get(&path, 0, mPool);
+ mName = apr_psprintf(mPool, "%s/%s", path, mInfo->name);
+ }
}
void APRAnyFile::DoStat(void) {
|