2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.openapi
.vfs
.impl
.win32
;
18 import com
.intellij
.openapi
.vfs
.VirtualFile
;
19 import com
.intellij
.openapi
.vfs
.impl
.local
.LocalFileSystemBase
;
20 import org
.jetbrains
.annotations
.NotNull
;
22 import java
.io
.FileNotFoundException
;
23 import java
.util
.Collection
;
27 * @author Dmitry Avdeev
29 public class Win32LocalFileSystem
extends LocalFileSystemBase
{
31 private static Win32LocalFileSystem ourSystem
;
33 public static Win32LocalFileSystem
getWin32Instance() {
34 if (ourSystem
== null) {
35 ourSystem
= new Win32LocalFileSystem();
40 public static void release() {
44 private final Win32Kernel myKernel
= new Win32Kernel();
46 private Win32LocalFileSystem() {
50 public String
[] list(VirtualFile file
) {
52 String
[] strings
= myKernel
.list(file
.getPath());
53 //assert Arrays.asList(strings).equals(Arrays.asList(super.list(file)));
58 return super.list(file
);
63 public boolean exists(VirtualFile fileOrDirectory
) {
64 if (fileOrDirectory
.getParent() == null) return true;
65 boolean b
= myKernel
.exists(fileOrDirectory
.getPath());
66 //assert b == super.exists(fileOrDirectory);
71 public boolean isDirectory(VirtualFile file
) {
73 boolean b
= myKernel
.isDirectory(file
.getPath());
74 //assert b == super.isDirectory(file);
77 catch (FileNotFoundException e
) {
79 return super.isDirectory(file
);
84 public boolean isWritable(VirtualFile file
) {
86 boolean b
= myKernel
.isWritable(file
.getPath());
87 //assert b == super.isWritable(file);
90 catch (FileNotFoundException e
) {
91 // assert false: file;
92 return super.isWritable(file
);
97 public long getTimeStamp(VirtualFile file
) {
99 long timeStamp
= myKernel
.getTimeStamp(file
.getPath());
100 //assert timeStamp == super.getTimeStamp(file);
103 catch (FileNotFoundException e
) {
105 return super.getTimeStamp(file
);
110 public WatchRequest
addRootToWatch(@NotNull String rootPath
, boolean toWatchRecursively
) {
111 throw new UnsupportedOperationException();
116 public Set
<WatchRequest
> addRootsToWatch(@NotNull Collection
<String
> rootPaths
, boolean toWatchRecursively
) {
117 throw new UnsupportedOperationException();
121 public void removeWatchedRoots(@NotNull Collection
<WatchRequest
> rootsToWatch
) {
122 throw new UnsupportedOperationException();
126 public void removeWatchedRoot(@NotNull WatchRequest watchRequest
) {
127 throw new UnsupportedOperationException();