/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <direct.h>
#include <windows.h>
#include <io.h>
#include "jvm.h"
#include "jni.h"
#include "jni_util.h"
#include "jlong.h"
#include "io_util.h"
#include "dirent_md.h"
#include "java_io_FileSystem.h"
/* This macro relies upon the fact that JNU_GetStringPlatformChars always makes
a copy of the string */
JVM_NativePath((char *)var);
static struct {
} ids;
{
if (!fileClass) return;
}
/* -- Path operations -- */
extern int canonicalizeWithPrefix(const char* canonicalPrefix, const char *pathWithCanonicalPrefix, char *out, int len);
{
canonicalPath, JVM_MAXPATHLEN) < 0) {
} else {
}
return rv;
}
{
canonicalPath, JVM_MAXPATHLEN) < 0) {
} else {
}
return rv;
}
/* -- Attribute accessors -- */
/* Check whether or not the file name in "path" is a Windows reserved
device name (CON, PRN, AUX, NUL, COM[1-9], LPT[1-9]) based on the
returned result from GetFullPathName. If the file name in the path
is indeed a reserved device name GetFuulPathName returns
"\\.\[ReservedDeviceName]".
*/
buf,
&lpf);
return TRUE;
return TRUE;
}
return FALSE;
}
{
if (!isReservedDeviceName(path) &&
? java_io_FileSystem_BA_HIDDEN : 0));
}
return rv;
}
{
int mode;
switch (a) {
mode = 4;
break;
mode = 2;
break;
default: assert(0);
}
}
return rv;
}
{
if (access == java_io_FileSystem_ACCESS_READ ||
return enable;
}
DWORD a;
a = GetFileAttributes(path);
if (a != INVALID_FILE_ATTRIBUTES) {
if (enable)
a = a & ~FILE_ATTRIBUTE_READONLY;
else
a = a | FILE_ATTRIBUTE_READONLY;
if (SetFileAttributes(path, a))
}
return rv;
}
{
/* Win95, Win98, WinME */
if (h != INVALID_HANDLE_VALUE) {
FindClose(h);
rv -= 11644473600000;
}
return rv;
}
{
}
return rv;
}
/* -- File operations -- */
{
DWORD a;
int orv;
int error;
JVM_NativePath((char *)path);
if (orv < 0) {
if (orv != JVM_EEXIST) {
error = GetLastError();
// If a directory by the named path already exists,
// return false (behavior of solaris and linux) instead of
// throwing an exception
a = GetFileAttributes(path);
if ((a == INVALID_FILE_ATTRIBUTES) ||
!(a & FILE_ATTRIBUTE_DIRECTORY)) {
}
}
} else {
}
return rv;
}
static int
{
DWORD a;
SetFileAttributes(path, 0);
a = GetFileAttributes(path);
if (a == INVALID_FILE_ATTRIBUTES) {
return 1;
} else if (a & FILE_ATTRIBUTE_DIRECTORY) {
return !RemoveDirectory(path);
} else {
return !DeleteFile(path);
}
}
{
if (removeFileOrDirectory(path) == 0) {
}
return rv;
}
/* ## Clean this up to use direct Win32 calls */
{
/* Allocate an initial String array */
len = 0;
maxlen = 16;
/* Scan the directory */
continue;
}
}
/* Copy the final results into an appropriately-sized array */
return rv;
return NULL;
}
{
}
return rv;
}
{
}
return rv;
}
{
HANDLE h;
if (h != INVALID_HANDLE_VALUE) {
FILETIME t;
}
CloseHandle(h);
}
return rv;
}
{
DWORD a;
a = GetFileAttributes(path);
if (a != INVALID_FILE_ATTRIBUTES) {
}
return rv;
}
/* -- Filesystem interface -- */
{
return JNU_NewStringPlatform(env, p);
}
{
return GetLogicalDrives();
}
{
switch(t) {
break;
break;
break;
default:
assert(0);
}
}
return rv;
}