91 jlong result = 0; |
91 jlong result = 0; |
92 int flag = 0; |
92 int flag = 0; |
93 jzfile *zip = 0; |
93 jzfile *zip = 0; |
94 |
94 |
95 if (mode & OPEN_READ) flag |= O_RDONLY; |
95 if (mode & OPEN_READ) flag |= O_RDONLY; |
96 if (mode & OPEN_DELETE) flag |= JVM_O_DELETE; |
|
97 |
96 |
98 if (path != 0) { |
97 if (path != 0) { |
99 zip = ZIP_Get_From_Cache(path, &msg, lastModified); |
98 zip = ZIP_Get_From_Cache(path, &msg, lastModified); |
100 if (zip == 0 && msg == 0) { |
99 if (zip == 0 && msg == 0) { |
101 ZFILE zfd = 0; |
100 ZFILE zfd = 0; |
102 #ifdef WIN32 |
101 #ifdef WIN32 |
|
102 if (mode & OPEN_DELETE) flag |= O_TEMPORARY; |
103 zfd = winFileHandleOpen(env, name, flag); |
103 zfd = winFileHandleOpen(env, name, flag); |
104 if (zfd == -1) { |
104 if (zfd == -1) { |
105 /* Exception already pending. */ |
105 /* Exception already pending. */ |
106 goto finally; |
106 goto finally; |
107 } |
107 } |
108 #else |
108 #else |
109 zfd = JVM_Open(path, flag, 0); |
109 zfd = open(path, flag, 0); |
110 if (zfd < 0) { |
110 if (zfd < 0) { |
111 throwFileNotFoundException(env, name); |
111 throwFileNotFoundException(env, name); |
112 goto finally; |
112 goto finally; |
|
113 } |
|
114 if (mode & OPEN_DELETE) { |
|
115 unlink(path); |
113 } |
116 } |
114 #endif |
117 #endif |
115 zip = ZIP_Put_In_Cache0(path, zfd, &msg, lastModified, usemmap); |
118 zip = ZIP_Put_In_Cache0(path, zfd, &msg, lastModified, usemmap); |
116 } |
119 } |
117 |
120 |