diff --git a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/.project b/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/.project deleted file mode 100644 index affc913b876..00000000000 --- a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.eclipse.core.filesystem.win32.x86_64 - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/.settings/org.eclipse.core.resources.prefs b/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0203a..00000000000 --- a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/.settings/org.eclipse.core.runtime.prefs b/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 5a0ad22d2a7..00000000000 --- a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -line.separator=\n diff --git a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/BUILD_INFO.txt b/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/BUILD_INFO.txt deleted file mode 100644 index 2fdc2dcbb72..00000000000 --- a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/BUILD_INFO.txt +++ /dev/null @@ -1,10 +0,0 @@ -Native Build Info: ------------------- - -platform: win32.x86_64 -built by: Szymon.Brandys@pl.ibm.com -build date: 12-Nov-2012 -OS Name: Microsoft Windows 7 -Compiler version: Microsoft (R) C/C++ Optimizing Compiler Version 14.00.50727.42 for x64 -Linker version: Microsoft (R) Incremental Linker Version 8.00.50727.762 -Java version: Standard Edition (ibm-java2-sdk-50-win-i386) diff --git a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/META-INF/MANIFEST.MF b/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/META-INF/MANIFEST.MF deleted file mode 100644 index c8c717b9c36..00000000000 --- a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/META-INF/MANIFEST.MF +++ /dev/null @@ -1,9 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %fragmentName -Bundle-SymbolicName: org.eclipse.core.filesystem.win32.x86_64; singleton:=true -Bundle-Version: 1.4.300.qualifier -Bundle-Vendor: %providerName -Fragment-Host: org.eclipse.core.filesystem;bundle-version="[1.4.0,2.0.0)" -Bundle-Localization: fragment -Eclipse-PlatformFilter: (& (osgi.os=win32) (osgi.arch=x86_64)) diff --git a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/about.html b/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/about.html deleted file mode 100644 index 164f781a8fd..00000000000 --- a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/about.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - -About - - -

About This Content

- -

November 30, 2017

-

License

- -

- The Eclipse Foundation makes available all content in this plug-in - ("Content"). Unless otherwise indicated below, the Content - is provided to you under the terms and conditions of the Eclipse - Public License Version 2.0 ("EPL"). A copy of the EPL is - available at http://www.eclipse.org/legal/epl-2.0. - For purposes of the EPL, "Program" will mean the Content. -

- -

- If you did not receive this Content directly from the Eclipse - Foundation, the Content is being redistributed by another party - ("Redistributor") and different terms and conditions may - apply to your use of any object code in the Content. Check the - Redistributor's license that was provided with the Content. If no such - license exists, contact the Redistributor. Unless otherwise indicated - below, the terms and conditions of the EPL still apply to any source - code in the Content and such source code may be obtained at http://www.eclipse.org. -

- - - \ No newline at end of file diff --git a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/build.properties b/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/build.properties deleted file mode 100644 index be8f4938042..00000000000 --- a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/build.properties +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################### -# Copyright (c) 2009 IBM Corporation and others. -# -# This program and the accompanying materials -# are made available under the terms of the Eclipse Public License 2.0 -# which accompanies this distribution, and is available at -# https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -bin.includes = os/,\ - fragment.properties,\ - .,\ - META-INF/,\ - about.html -src.includes = about.html -generateSourceBundle=false diff --git a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/fragment.properties b/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/fragment.properties deleted file mode 100644 index 26ae06fa2b2..00000000000 --- a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/fragment.properties +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################### -# Copyright (c) 2009 IBM Corporation and others. -# -# This program and the accompanying materials -# are made available under the terms of the Eclipse Public License 2.0 -# which accompanies this distribution, and is available at -# https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -fragmentName = Core File System for Windows 64 bit -providerName = Eclipse.org diff --git a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/os/win32/x86_64/localfile_1_0_0.dll b/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/os/win32/x86_64/localfile_1_0_0.dll deleted file mode 100644 index 99469891aba..00000000000 Binary files a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/os/win32/x86_64/localfile_1_0_0.dll and /dev/null differ diff --git a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/pom.xml b/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/pom.xml deleted file mode 100644 index b297223f7f0..00000000000 --- a/resources/bundles/org.eclipse.core.filesystem.win32.x86_64/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - 4.0.0 - - eclipse.platform.resources - org.eclipse.platform - 4.33.0-SNAPSHOT - ../../ - - org.eclipse.core.filesystem.win32.x86_64 - 1.4.300-SNAPSHOT - eclipse-plugin - - diff --git a/resources/bundles/org.eclipse.core.filesystem/natives/localfile.h b/resources/bundles/org.eclipse.core.filesystem/natives/localfile.h deleted file mode 100644 index e7630e1a2a0..00000000000 --- a/resources/bundles/org.eclipse.core.filesystem/natives/localfile.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2000, 2024 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - * Martin Oberhuber (Wind River) - [170317] add symbolic link support to API - * Martin Oberhuber (Wind River) - [184534] get attributes from native lib - */ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for core library */ - -#ifndef _Included_CORE_LIBRARY -#define _Included_CORE_LIBRARY -#ifdef __cplusplus -extern "C" { -#endif - -//values from EFS -#undef ATTRIBUTE_DIRECTORY -#define ATTRIBUTE_DIRECTORY 0x01l -#undef ATTRIBUTE_READ_ONLY -#define ATTRIBUTE_READ_ONLY 0x02l -#undef ATTRIBUTE_EXECUTABLE -#define ATTRIBUTE_EXECUTABLE 0x04l -#undef ATTRIBUTE_ARCHIVE -#define ATTRIBUTE_ARCHIVE 0x08l -#undef ATTRIBUTE_HIDDEN -#define ATTRIBUTE_HIDDEN 0x10l -#undef ATTRIBUTE_SYMLINK -#define ATTRIBUTE_SYMLINK 0x20l -#undef ATTRIBUTE_LINK_TARGET -#define ATTRIBUTE_LINK_TARGET 0x40l -#undef SET_ATTRIBUTES -#define SET_ATTRIBUTES 0x01l -#undef SET_LAST_MODIFIED -#define SET_LAST_MODIFIED 0x02l - -/* - * Class: org_eclipse_core_internal_filesystem_local_LocalFileNatives - * Method: nativeAttributes - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_filesystem_local_LocalFileNatives_nativeAttributes - (JNIEnv *, jclass); - -/* - * Class: org_eclipse_core_internal_filesystem_local_LocalFileNatives - * Method: internalGetFileInfoW - * Signature: ([CLorg/eclipse/core/filesystem/IFileInfo;)Z - */ -JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_filesystem_local_LocalFileNatives_internalGetFileInfoW - (JNIEnv *env, jclass clazz, jcharArray target, jobject fileInfo); - -/* - * Class: org_eclipse_core_internal_filesystem_local_LocalFileNatives - * Method: internalSetFileInfoW - * Signature: ([BLorg/eclipse/core/filesystem/IFileInfo;)Z - */ -JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_filesystem_local_LocalFileNatives_internalSetFileInfoW - (JNIEnv *env, jclass clazz, jcharArray target, jobject obj, jint options); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/resources/bundles/org.eclipse.core.filesystem/natives/win32/localfile.c b/resources/bundles/org.eclipse.core.filesystem/natives/win32/localfile.c deleted file mode 100644 index 36f968a116e..00000000000 --- a/resources/bundles/org.eclipse.core.filesystem/natives/win32/localfile.c +++ /dev/null @@ -1,364 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * * IBM Corporation - initial API and implementation - *******************************************************************************/ -#define _WIN32_WINNT 0x0500 -#include -#include -#include -#include -#include -#include "../localfile.h" -#include - -#ifndef IO_REPARSE_TAG_SYMLINK -#define IO_REPARSE_TAG_SYMLINK 0xA000000C -#endif - -// From IFileInfo.java -#undef IO_ERROR -#define IO_ERROR 5 - -typedef struct _REPARSE_DATA_BUFFER { - ULONG ReparseTag; - USHORT ReparseDataLength; - USHORT Reserved; - union { - struct { - USHORT SubstituteNameOffset; - USHORT SubstituteNameLength; - USHORT PrintNameOffset; - USHORT PrintNameLength; - ULONG Flags; - WCHAR PathBuffer[1]; - } SymbolicLinkReparseBuffer; - struct { - USHORT SubstituteNameOffset; - USHORT SubstituteNameLength; - USHORT PrintNameOffset; - USHORT PrintNameLength; - WCHAR PathBuffer[1]; - } MountPointReparseBuffer; - struct { - UCHAR DataBuffer[1]; - } GenericReparseBuffer; - }; -} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; - -/* - * Converts a FILETIME in a java long (milliseconds). - */ -jlong fileTimeToMillis(FILETIME ft) { - - ULONGLONG millis = (((ULONGLONG) ft.dwHighDateTime) << 32) + ft.dwLowDateTime; - millis = millis / 10000; - // difference in milliseconds between - // January 1, 1601 00:00:00 UTC (Windows FILETIME) - // January 1, 1970 00:00:00 UTC (Java long) - // = 11644473600000 - millis -= 11644473600000; - return millis; -} - -/* - * Class: org_eclipse_core_internal_filesystem_local_LocalFileNatives - * Method: nativeAttributes - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_core_internal_filesystem_local_LocalFileNatives_nativeAttributes - (JNIEnv *env, jclass clazz) { - jint attributes = ATTRIBUTE_READ_ONLY | ATTRIBUTE_ARCHIVE | ATTRIBUTE_HIDDEN; - HMODULE kernelModule = LoadLibraryW(L"kernel32.dll"); - if (kernelModule == NULL) - return attributes; - if (GetProcAddress(kernelModule, "CreateSymbolicLinkW") != NULL) - attributes |= ATTRIBUTE_SYMLINK | ATTRIBUTE_LINK_TARGET; - FreeLibrary(kernelModule); - return attributes; -} - -/* - * Get a null-terminated short array from a java char array. - * The returned short array needs to be freed when not used - * anymore. Use free(result) to do that. - */ -jchar* getCharArray(JNIEnv *env, jcharArray target) { - jsize n; - jchar *temp, *result; - - temp = (*env)->GetCharArrayElements(env, target, 0); - n = (*env)->GetArrayLength(env, target); - result = malloc((n+1) * sizeof(jchar)); - memcpy(result, temp, n * sizeof(jchar)); - result[n] = 0; - (*env)->ReleaseCharArrayElements(env, target, temp, 0); - return result; -} - -/* - * Set symbolic link information in IFileInfo - */ -jboolean setSymlinkInFileInfo (JNIEnv *env, jobject fileInfo, jstring linkTarget) { - jclass cls; - jmethodID mid; - - cls = (*env)->GetObjectClass(env, fileInfo); - if (cls == 0) return JNI_FALSE; - - // set symlink attribute - mid = (*env)->GetMethodID(env, cls, "setAttribute", "(IZ)V"); - if (mid == 0) return JNI_FALSE; - (*env)->CallVoidMethod(env, fileInfo, mid, ATTRIBUTE_SYMLINK, JNI_TRUE); - - // set link target - mid = (*env)->GetMethodID(env, cls, "setStringAttribute", "(ILjava/lang/String;)V"); - if (mid == 0) return JNI_FALSE; - (*env)->CallVoidMethod(env, fileInfo, mid, ATTRIBUTE_LINK_TARGET, linkTarget); - return JNI_TRUE; -} - - -/* - * Converts a WIN32_FIND_DATAW to IFileInfo - */ -jboolean convertFindDataWToFileInfo(JNIEnv *env, WIN32_FIND_DATAW info, jobject fileInfo, jchar *filename) { - jclass cls; - jmethodID mid; - jstring nameString; - ULONGLONG fileLength; - - cls = (*env)->GetObjectClass(env, fileInfo); - if (cls == 0) return JNI_FALSE; - - // select interesting information - //exists - mid = (*env)->GetMethodID(env, cls, "setExists", "(Z)V"); - if (mid == 0) return JNI_FALSE; - (*env)->CallVoidMethod(env, fileInfo, mid, JNI_TRUE); - - // file name - mid = (*env)->GetMethodID(env, cls, "setName", "(Ljava/lang/String;)V"); - if (mid == 0) return JNI_FALSE; - nameString = (*env)->NewString(env, - (jchar *)info.cFileName, - wcslen(info.cFileName)); - (*env)->CallVoidMethod(env, fileInfo, mid, nameString); - - // last modified - mid = (*env)->GetMethodID(env, cls, "setLastModified", "(J)V"); - if (mid == 0) return JNI_FALSE; - (*env)->CallVoidMethod(env, fileInfo, mid, fileTimeToMillis(info.ftLastWriteTime)); - - // file length - fileLength =(info.nFileSizeHigh * (((ULONGLONG)MAXDWORD)+1)) + info.nFileSizeLow; - mid = (*env)->GetMethodID(env, cls, "setLength", "(J)V"); - if (mid == 0) return JNI_FALSE; - (*env)->CallVoidMethod(env, fileInfo, mid, fileLength); - - // folder or file? - if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - mid = (*env)->GetMethodID(env, cls, "setAttribute", "(IZ)V"); - if (mid == 0) return JNI_FALSE; - (*env)->CallVoidMethod(env, fileInfo, mid, ATTRIBUTE_DIRECTORY, JNI_TRUE); - } - - // read-only? - if (info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) { - mid = (*env)->GetMethodID(env, cls, "setAttribute", "(IZ)V"); - if (mid == 0) return JNI_FALSE; - (*env)->CallVoidMethod(env, fileInfo, mid, ATTRIBUTE_READ_ONLY, JNI_TRUE); - } - - // archive? - if (info.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) { - mid = (*env)->GetMethodID(env, cls, "setAttribute", "(IZ)V"); - if (mid == 0) return JNI_FALSE; - (*env)->CallVoidMethod(env, fileInfo, mid, ATTRIBUTE_ARCHIVE, JNI_TRUE); - } - - // hidden? - if (info.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) { - mid = (*env)->GetMethodID(env, cls, "setAttribute", "(IZ)V"); - if (mid == 0) return JNI_FALSE; - (*env)->CallVoidMethod(env, fileInfo, mid, ATTRIBUTE_HIDDEN, JNI_TRUE); - } - - if ((info.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) && - info.dwReserved0 == IO_REPARSE_TAG_SYMLINK) { - REPARSE_DATA_BUFFER *rdb; - DWORD bytesReturned; - BOOL result; - jstring nameString; - jsize len; - HANDLE fh = CreateFileW(filename, FILE_READ_EA, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, NULL); - if (fh == INVALID_HANDLE_VALUE) { - goto error; - } - - rdb = malloc(MAXIMUM_REPARSE_DATA_BUFFER_SIZE); - if (rdb == NULL) { - CloseHandle(fh); - goto error; - } - - result = DeviceIoControl(fh, FSCTL_GET_REPARSE_POINT, NULL, 0, rdb, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &bytesReturned, NULL); - - CloseHandle(fh); - if (!result) { - free(rdb); - goto error; - } - - //check again, make sure it has not changed - if (rdb->ReparseTag == IO_REPARSE_TAG_SYMLINK) { - WCHAR *targetName; - len = rdb->SymbolicLinkReparseBuffer.PrintNameLength / sizeof(WCHAR); - if (len > 0) { - targetName = &rdb->SymbolicLinkReparseBuffer.PathBuffer[rdb->SymbolicLinkReparseBuffer.PrintNameOffset / sizeof(WCHAR)]; - } else { - len = rdb->SymbolicLinkReparseBuffer.SubstituteNameLength / sizeof(WCHAR); - targetName = &rdb->SymbolicLinkReparseBuffer.PathBuffer[rdb->SymbolicLinkReparseBuffer.SubstituteNameOffset / sizeof(WCHAR)]; - } - nameString = (*env)->NewString(env, (jchar *)targetName, len); - free(rdb); - } else { - free(rdb); -error: - nameString = (*env)->NewString(env, (jchar *)&nameString, 0); - } - if (nameString == NULL) { - return JNI_FALSE; - } - return setSymlinkInFileInfo(env, fileInfo, nameString); - } - return JNI_TRUE; -} - -/* - * Fills in the data for an IFileInfo structure representing an empty root directory. - */ -jboolean fillEmptyDirectory(JNIEnv *env, jobject fileInfo) { - jclass cls; - jmethodID mid; - - cls = (*env)->GetObjectClass(env, fileInfo); - if (cls == 0) return JNI_FALSE; - mid = (*env)->GetMethodID(env, cls, "setAttribute", "(IZ)V"); - if (mid == 0) return JNI_FALSE; - (*env)->CallVoidMethod(env, fileInfo, mid, ATTRIBUTE_DIRECTORY, JNI_TRUE); - mid = (*env)->GetMethodID(env, cls, "setExists", "(Z)V"); - if (mid == 0) return JNI_FALSE; - (*env)->CallVoidMethod(env, fileInfo, mid, JNI_TRUE); - return JNI_TRUE; -} - -/* - * Calls FileInfo.setError(IFileInfo.IO_ERROR). - */ -jboolean setIOError(JNIEnv *env, jobject fileInfo) { - jclass cls; - jmethodID mid; - cls = (*env)->GetObjectClass(env, fileInfo); - if (cls != 0) return JNI_FALSE; - mid = (*env)->GetMethodID(env, cls, "setAttribute", "(I)V"); - if (mid == 0) return JNI_FALSE; - (*env)->CallVoidMethod(env, fileInfo, mid, IO_ERROR); - return JNI_TRUE; -} - -/* - * Class: org_eclipse_core_internal_filesystem_local_LocalFileNatives - * Method: internalGetFileInfoW - * Signature: ([CLorg/eclipse/core/filesystem/IFileInfo;)Z - */ -JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_filesystem_local_LocalFileNatives_internalGetFileInfoW - (JNIEnv *env, jclass clazz, jcharArray target, jobject fileInfo) { - jchar *name; - jsize size; - HANDLE handle; - WIN32_FIND_DATAW info; - jboolean result; - - name = getCharArray(env, target); - size = (*env)->GetArrayLength(env, target); - // FindFirstFile does not work at the root level. However, we - // don't need it because the root will never change timestamp - // The pattern \\?\c:\ represents a root path - if (size == 7 && name[2] == '?' && name[5] == ':' && name[6] == '\\') { - free(name); - return fillEmptyDirectory(env, fileInfo); - } - handle = FindFirstFileW(name, &info); - if (handle == INVALID_HANDLE_VALUE) { - free(name); - if (GetLastError() != ERROR_FILE_NOT_FOUND) - setIOError(env, fileInfo); - return JNI_FALSE; - } - - FindClose(handle); - result = convertFindDataWToFileInfo(env, info, fileInfo, name); - free(name); - return result; -} - -/* - * Class: org_eclipse_core_internal_filesystem_local_LocalFileNatives - * Method: internalSetFileInfoW - * Signature: ([BLorg/eclipse/core/filesystem/IFileInfo;)Z - */ -JNIEXPORT jboolean JNICALL Java_org_eclipse_core_internal_filesystem_local_LocalFileNatives_internalSetFileInfoW - (JNIEnv *env, jclass clazz, jcharArray target, jobject obj, jint options) { - - HANDLE handle; - jmethodID mid; - jchar *targetFile; - int success = JNI_FALSE; - DWORD attributes; - jclass cls; - jboolean readOnly, hidden, archive; - - /* find out if we need to set the readonly bit */ - cls = (*env)->GetObjectClass(env, obj); - mid = (*env)->GetMethodID(env, cls, "getAttribute", "(I)Z"); - if (mid == 0) goto fail; - readOnly = (*env)->CallBooleanMethod(env, obj, mid, ATTRIBUTE_READ_ONLY); - - /* find out if we need to set the archive bit */ - archive = (*env)->CallBooleanMethod(env, obj, mid, ATTRIBUTE_ARCHIVE); - - /* find out if we need to set the hidden bit */ - hidden = (*env)->CallBooleanMethod(env, obj, mid, ATTRIBUTE_HIDDEN); - - targetFile = getCharArray(env, target); - attributes = GetFileAttributesW(targetFile); - if (attributes == (DWORD)-1) goto fail; - - if (readOnly) - attributes = attributes | FILE_ATTRIBUTE_READONLY; - else - attributes = attributes & ~FILE_ATTRIBUTE_READONLY; - if (archive) - attributes = attributes | FILE_ATTRIBUTE_ARCHIVE; - else - attributes = attributes & ~FILE_ATTRIBUTE_ARCHIVE; - if (hidden) - attributes = attributes | FILE_ATTRIBUTE_HIDDEN; - else - attributes = attributes & ~FILE_ATTRIBUTE_HIDDEN; - - success = SetFileAttributesW(targetFile, attributes); - -fail: - free(targetFile); - return success; -} diff --git a/resources/bundles/org.eclipse.core.filesystem/natives/win32/x64/make_x64.bat b/resources/bundles/org.eclipse.core.filesystem/natives/win32/x64/make_x64.bat deleted file mode 100644 index 985afeaff74..00000000000 --- a/resources/bundles/org.eclipse.core.filesystem/natives/win32/x64/make_x64.bat +++ /dev/null @@ -1,28 +0,0 @@ -@rem *************************************************************************** -@rem Copyright (c) 2009, 2024 IBM Corporation and others. -@rem -@rem This program and the accompanying materials -@rem are made available under the terms of the Eclipse Public License 2.0 -@rem which accompanies this distribution, and is available at -@rem https://www.eclipse.org/legal/epl-2.0/ -@rem -@rem SPDX-License-Identifier: EPL-2.0 -@rem -@rem Contributors: -@rem IBM Corporation - initial API and implementation -@rem *************************************************************************** -@echo off - -cd %~dp0 - -del localfile.obj -del localfile_1_0_0* - -if "%MSVC_HOME%"=="" set MSVC_HOME=C:\Program Files\Microsoft Visual Studio\2022\Community - -call "%MSVC_HOME%\VC\Auxiliary\Build\vcvarsall.bat" x64 - -set lib_includes=UUID.LIB LIBCMT.LIB OLDNAMES.LIB KERNEL32.LIB -set dll_name=localfile_1_0_0 - -cl ..\localfile.c -I"%JAVA_HOME%\include" -I"%JAVA_HOME%\include\win32" -LD -Fe%dll_name% /link %lib_includes% /Subsystem:CONSOLE diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/Convert.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/Convert.java index cf6a638724b..04593d46eb9 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/Convert.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/Convert.java @@ -22,9 +22,6 @@ public class Convert { /** Indicates the default native encoding on this platform */ private static String defaultEncoding = Platform.getSystemCharset().name(); - /** Indicates if we are running on windows */ - private static final boolean IS_WINDOWS = Platform.OS.isWindows(); - public static final String WIN32_RAW_PATH_PREFIX = "\\\\?\\"; //$NON-NLS-1$ public static final String WIN32_UNC_RAW_PATH_PREFIX = "\\\\?\\UNC"; //$NON-NLS-1$ @@ -65,31 +62,4 @@ public static byte[] toPlatformBytes(String target) { return target.getBytes(); } } - - /** - * Converts a file name to a unicode char[] suitable for use by native methods. - * See https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file - */ - public static char[] toPlatformChars(String target) { - //Windows use special prefix to handle long filenames - if (!IS_WINDOWS) { - return target.toCharArray(); - } - //convert UNC path of form \\server\path to unicode form \\?\UNC\server\path - if (target.startsWith("\\\\")) { //$NON-NLS-1$ - int nameLength = target.length(); - int prefixLength = WIN32_UNC_RAW_PATH_PREFIX.length(); - char[] result = new char[prefixLength + nameLength - 1]; - WIN32_UNC_RAW_PATH_PREFIX.getChars(0, prefixLength, result, 0); - target.getChars(1, nameLength, result, prefixLength); - return result; - } - //convert simple path of form c:\path to unicode form \\?\c:\path - int nameLength = target.length(); - int prefixLength = WIN32_RAW_PATH_PREFIX.length(); - char[] result = new char[prefixLength + nameLength]; - WIN32_RAW_PATH_PREFIX.getChars(0, prefixLength, result, 0); - target.getChars(0, nameLength, result, prefixLength); - return result; - } } diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileHandler.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileHandler.java deleted file mode 100644 index 92589e00b52..00000000000 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012, 2015 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.core.internal.filesystem.local; - -import org.eclipse.core.filesystem.IFileInfo; -import org.eclipse.core.filesystem.provider.FileInfo; - -/** - * Native handler that delegates to the LocalFileNatives. - */ -public class LocalFileHandler extends NativeHandler { - @Override - public int getSupportedAttributes() { - return LocalFileNatives.attributes(); - } - - @Override - public FileInfo fetchFileInfo(String fileName) { - return LocalFileNatives.fetchFileInfo(fileName); - } - - @Override - public boolean putFileInfo(String fileName, IFileInfo info, int options) { - return LocalFileNatives.putFileInfo(fileName, info, options); - } -} diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNatives.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNatives.java deleted file mode 100644 index 19ea1cfdbb2..00000000000 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNatives.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2024 IBM Corporation and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * IBM Corporation - initial API and implementation - * Martin Oberhuber (Wind River) - [184534] get attributes from native lib - *******************************************************************************/ -package org.eclipse.core.internal.filesystem.local; - -import java.net.URL; -import java.util.Enumeration; -import org.eclipse.core.filesystem.IFileInfo; -import org.eclipse.core.filesystem.IFileSystem; -import org.eclipse.core.filesystem.provider.FileInfo; -import org.eclipse.core.internal.filesystem.FileSystemAccess; -import org.eclipse.core.internal.filesystem.Messages; -import org.eclipse.core.internal.filesystem.Policy; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.osgi.util.NLS; - -abstract class LocalFileNatives { - private static boolean hasNatives = false; - private static int nativeAttributes = -1; - - /** instance of this library */ - // The name convention is to use the plugin version at the time the library is changed. - private static final String LIBRARY_NAME = "localfile_1_0_0"; //$NON-NLS-1$ - - static { - try { - System.loadLibrary(LIBRARY_NAME); - hasNatives = true; - try { - nativeAttributes = nativeAttributes(); - } catch (UnsatisfiedLinkError e) { - // older native implementations did not support this - // call, so we need to handle the error silently - } - } catch (UnsatisfiedLinkError e) { - if (isLibraryPresent()) - logMissingNativeLibrary(e); - } - } - - private static boolean isLibraryPresent() { - String libName = System.mapLibraryName(LIBRARY_NAME); - Enumeration entries = FileSystemAccess.findEntries("/", libName, true); //$NON-NLS-1$ - return entries != null && entries.hasMoreElements(); - } - - private static void logMissingNativeLibrary(UnsatisfiedLinkError e) { - String libName = System.mapLibraryName(LIBRARY_NAME); - String message = NLS.bind(Messages.couldNotLoadLibrary, libName); - Policy.log(IStatus.INFO, message, e); - } - - /** - * Return the bit-mask of EFS attributes that this native - * file system implementation supports. - *

- * This is an optional method: if it has not been compiled - * into the native library, the client must catch the - * resulting UnsatisfiedLinkError and handle attributes - * as known by older version libraries. - *

- * @see IFileSystem#attributes() - * @return an integer bit mask of attributes. - */ - private static final native int nativeAttributes(); - - /** - * Return the value that the native library thinks - * {@link IFileSystem#attributes()} should return. - * - * Returns -1 when the native library has not been - * loaded, or is a version that does not support - * this investigation method yet. - * - * @return an positive value that is a bit-mask - * suitable for use in {@link IFileSystem#attributes}, - * or -1 if native attributes are not available. - */ - public static int attributes() { - return nativeAttributes; - } - - /** - * @return The file info - */ - public static FileInfo fetchFileInfo(String fileName) { - FileInfo info = new FileInfo(); - internalGetFileInfoW(Convert.toPlatformChars(fileName), info); - return info; - } - - /** - * Stores the file information for the specified filename in the supplied file - * information object. This avoids multiple JNI calls. - */ - private static final native boolean internalGetFileInfoW(char[] fileName, IFileInfo info); - - /** Set the extended attributes specified in the IResource attribute object. Only - * attributes that the platform supports will be set. (Unicode version - should not - * be called if isUnicode is false). */ - private static final native boolean internalSetFileInfoW(char[] fileName, IFileInfo attribute, int options); - - public static boolean putFileInfo(String fileName, IFileInfo info, int options) { - return internalSetFileInfoW(Convert.toPlatformChars(fileName), info, options); - } - - /** - * Return true if we have found the core library and are using it for - * our file-system calls, and false otherwise. - * @return true if native library is available, and false - * otherwise. - */ - public static boolean isUsingNatives() { - return hasNatives; - } -} diff --git a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNativesManager.java b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNativesManager.java index e9a8bd62f29..9900dfe253f 100644 --- a/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNativesManager.java +++ b/resources/bundles/org.eclipse.core.filesystem/src/org/eclipse/core/internal/filesystem/local/LocalFileNativesManager.java @@ -37,7 +37,7 @@ * without it.

*/ public class LocalFileNativesManager { - public static final boolean PROPERTY_USE_NATIVE_DEFAULT = Platform.OS.isWindows() ? false : true; + public static final boolean PROPERTY_USE_NATIVE_DEFAULT = true; public static final String PROPERTY_USE_NATIVES = "eclipse.filesystem.useNatives"; //$NON-NLS-1$ private static NativeHandler HANDLER; @@ -58,14 +58,9 @@ public static void reset() { */ public static boolean setUsingNative(boolean useNatives) { boolean nativesAreUsed; - boolean isWindowsOS = Platform.OS.isWindows(); - - if (useNatives && !isWindowsOS && UnixFileNatives.isUsingNatives()) { + if (useNatives && !Platform.OS.isWindows() && UnixFileNatives.isUsingNatives()) { HANDLER = new UnixFileHandler(); nativesAreUsed = true; - } else if (useNatives && isWindowsOS && LocalFileNatives.isUsingNatives()) { - HANDLER = new LocalFileHandler(); - nativesAreUsed = true; } else { nativesAreUsed = false; Set views = FileSystems.getDefault().supportedFileAttributeViews();