summaryrefslogtreecommitdiffstats
path: root/src/H5Flow.c
diff options
context:
space:
mode:
authorPatrick Lu <ptlu@hawkwind.ncsa.uiuc.edu>1999-03-22 17:53:24 (GMT)
committerPatrick Lu <ptlu@hawkwind.ncsa.uiuc.edu>1999-03-22 17:53:24 (GMT)
commit8f0f2e440505cabdb0984a2b47db7d998040ecf3 (patch)
tree43af7d93ace7471959845da7feccdbc50af6ae36 /src/H5Flow.c
parent035c00dcef827676d4e28fa2d8cc46afddb7e94c (diff)
downloadhdf5-8f0f2e440505cabdb0984a2b47db7d998040ecf3.zip
hdf5-8f0f2e440505cabdb0984a2b47db7d998040ecf3.tar.gz
hdf5-8f0f2e440505cabdb0984a2b47db7d998040ecf3.tar.bz2
[svn-r1157]
in the H5F_low_access() and the H5F_sec2_open() functions I put code in here so we can figure out the path of the file and store it in the search_t struct
Diffstat (limited to 'src/H5Flow.c')
-rw-r--r--src/H5Flow.c55
1 files changed, 42 insertions, 13 deletions
diff --git a/src/H5Flow.c b/src/H5Flow.c
index 1223f87..c1b426d 100644
--- a/src/H5Flow.c
+++ b/src/H5Flow.c
@@ -481,10 +481,7 @@ H5F_low_access(const H5F_low_class_t *type, const char *name,
{
htri_t ret_value;
struct stat sb;
-#ifdef WIN32
- int fid;
-#endif
-
+
FUNC_ENTER(H5F_low_size, FAIL);
assert(type);
@@ -493,20 +490,52 @@ H5F_low_access(const H5F_low_class_t *type, const char *name,
} else {
ret_value = (0 == HDaccess(name, mode) ? TRUE : FALSE);
if (key) {
+
#ifdef WIN32
- /*
- * This extra block is needed because windows sets the st_dev
- * member of sb to be 0 if it is a file which makes the comparison
- * below wrong
- */
- fid=open(name,mode|_O_BINARY);
- HDfstat(fid,&sb);
- close(fid);
+
+/*
+ some windows specific types. the LPSTR is just a char*
+*/
+ LPSTR pathbuf = NULL;
+ LPSTR *namebuf = NULL;
+ int bufsize = 0;
+
+
+ /*
+ gets the full path of the file name. the if statement below is to try
+ to distinguish if we have the ablosute path already
+ */
+
+ if ((*(name+1) != ':') && (*(name+2)!= '\\')){
+ /*
+ if the size of the buffer is too small it will return
+ the appropriate size of the buffer not including the null
+ */
+ bufsize = GetFullPathName(name,bufsize,pathbuf,namebuf);
+ if (bufsize != 0){
+ pathbuf = malloc(sizeof(char) * (bufsize + 1));
+ namebuf = malloc(sizeof(char) * (bufsize + 1));
+ bufsize++;
+ GetFullPathName(name,bufsize,pathbuf,namebuf);
+ }
+ else {
+ pathbuf = NULL;
+ }
+ }
+ else {
+ pathbuf = malloc(strlen(name));
+ strcpy(pathbuf,name);
+ }
+
+ key->path = pathbuf;
+ key->dev = 0;
+ key->ino = 0;
#else
HDstat(name, &sb);
-#endif
+ key->path = NULL;
key->dev = sb.st_dev;
key->ino = sb.st_ino;
+#endif
}
}