diff --git a/classlib/src/main/java/org/teavm/classlib/java/io/TFile.java b/classlib/src/main/java/org/teavm/classlib/java/io/TFile.java index 1904bd578..a17cfb8e2 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/io/TFile.java +++ b/classlib/src/main/java/org/teavm/classlib/java/io/TFile.java @@ -23,10 +23,10 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.Arrays; import java.util.Objects; -import org.teavm.classlib.fs.VirtualFile; -import org.teavm.classlib.fs.VirtualFileSystem; -import org.teavm.classlib.fs.VirtualFileSystemProvider; import org.teavm.classlib.java.util.TRandom; +import org.teavm.runtime.fs.VirtualFile; +import org.teavm.runtime.fs.VirtualFileSystem; +import org.teavm.runtime.fs.VirtualFileSystemProvider; public class TFile implements Serializable, Comparable { private String path; diff --git a/classlib/src/main/java/org/teavm/classlib/java/io/TFileInputStream.java b/classlib/src/main/java/org/teavm/classlib/java/io/TFileInputStream.java index e847bf595..e2b4793ec 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/io/TFileInputStream.java +++ b/classlib/src/main/java/org/teavm/classlib/java/io/TFileInputStream.java @@ -19,8 +19,8 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Objects; -import org.teavm.classlib.fs.VirtualFile; -import org.teavm.classlib.fs.VirtualFileAccessor; +import org.teavm.runtime.fs.VirtualFile; +import org.teavm.runtime.fs.VirtualFileAccessor; public class TFileInputStream extends InputStream { private static final byte[] ONE_BYTE_BUFFER = new byte[1]; diff --git a/classlib/src/main/java/org/teavm/classlib/java/io/TFileOutputStream.java b/classlib/src/main/java/org/teavm/classlib/java/io/TFileOutputStream.java index 30e04bf9e..fea2f998a 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/io/TFileOutputStream.java +++ b/classlib/src/main/java/org/teavm/classlib/java/io/TFileOutputStream.java @@ -20,8 +20,8 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.OutputStream; import java.util.Objects; -import org.teavm.classlib.fs.VirtualFile; -import org.teavm.classlib.fs.VirtualFileAccessor; +import org.teavm.runtime.fs.VirtualFile; +import org.teavm.runtime.fs.VirtualFileAccessor; public class TFileOutputStream extends OutputStream { private static final byte[] ONE_BYTE_BUFER = new byte[1]; diff --git a/classlib/src/main/java/org/teavm/classlib/java/io/TRandomAccessFile.java b/classlib/src/main/java/org/teavm/classlib/java/io/TRandomAccessFile.java index 518d73df6..2dc44cc35 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/io/TRandomAccessFile.java +++ b/classlib/src/main/java/org/teavm/classlib/java/io/TRandomAccessFile.java @@ -23,10 +23,10 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.UTFDataFormatException; import java.util.Objects; -import org.teavm.classlib.fs.VirtualFile; -import org.teavm.classlib.fs.VirtualFileAccessor; import org.teavm.classlib.java.lang.TIndexOutOfBoundsException; import org.teavm.classlib.java.lang.TNullPointerException; +import org.teavm.runtime.fs.VirtualFile; +import org.teavm.runtime.fs.VirtualFileAccessor; public class TRandomAccessFile implements DataInput, DataOutput, Closeable { private static final byte[] ONE_BYTE_BUFFER = new byte[1]; diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java index 6c3f5d9a2..906f77cf8 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java @@ -18,12 +18,11 @@ package org.teavm.classlib.java.lang; import java.util.Enumeration; import java.util.Properties; import org.teavm.backend.c.intrinsic.RuntimeInclude; +import org.teavm.backend.c.runtime.Memory; +import org.teavm.backend.c.runtime.fs.CFileSystem; import org.teavm.backend.javascript.spi.GeneratedBy; import org.teavm.backend.wasm.runtime.WasmSupport; import org.teavm.classlib.PlatformDetector; -import org.teavm.classlib.fs.VirtualFileSystemProvider; -import org.teavm.classlib.fs.c.CFileSystem; -import org.teavm.classlib.impl.c.Memory; import org.teavm.classlib.impl.console.StderrOutputStream; import org.teavm.classlib.impl.console.StdoutOutputStream; import org.teavm.classlib.java.io.TConsole; @@ -41,6 +40,7 @@ import org.teavm.runtime.Allocator; import org.teavm.runtime.GC; import org.teavm.runtime.RuntimeArray; import org.teavm.runtime.RuntimeClass; +import org.teavm.runtime.fs.VirtualFileSystemProvider; public final class TSystem extends TObject { private static TPrintStream outCache; diff --git a/core/src/main/java/org/teavm/backend/c/CTarget.java b/core/src/main/java/org/teavm/backend/c/CTarget.java index 0883b340f..c3e72ae11 100644 --- a/core/src/main/java/org/teavm/backend/c/CTarget.java +++ b/core/src/main/java/org/teavm/backend/c/CTarget.java @@ -75,6 +75,7 @@ import org.teavm.backend.c.intrinsic.RuntimeClassIntrinsic; import org.teavm.backend.c.intrinsic.ShadowStackIntrinsic; import org.teavm.backend.c.intrinsic.StringsIntrinsic; import org.teavm.backend.c.intrinsic.StructureIntrinsic; +import org.teavm.backend.c.transform.CFileSystemTransformer; import org.teavm.backend.lowlevel.analyze.LowLevelInliningFilterFactory; import org.teavm.backend.lowlevel.dependency.ExceptionHandlingDependencyListener; import org.teavm.backend.lowlevel.dependency.StringsDependencyListener; @@ -227,6 +228,7 @@ public class CTarget implements TeaVMTarget, TeaVMCHost { transformers.add(new ClassPatch()); transformers.add(new CDependencyListener()); transformers.add(new WeakReferenceTransformation()); + transformers.add(new CFileSystemTransformer()); return transformers; } diff --git a/classlib/src/main/java/org/teavm/classlib/impl/c/CharPtr.java b/core/src/main/java/org/teavm/backend/c/runtime/CharPtr.java similarity index 90% rename from classlib/src/main/java/org/teavm/classlib/impl/c/CharPtr.java rename to core/src/main/java/org/teavm/backend/c/runtime/CharPtr.java index 8e3ae009e..f006bbcd1 100644 --- a/classlib/src/main/java/org/teavm/classlib/impl/c/CharPtr.java +++ b/core/src/main/java/org/teavm/backend/c/runtime/CharPtr.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 Alexey Andreev. + * Copyright 2022 Alexey Andreev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.impl.c; +package org.teavm.backend.c.runtime; import org.teavm.interop.Structure; diff --git a/classlib/src/main/java/org/teavm/classlib/impl/c/Memory.java b/core/src/main/java/org/teavm/backend/c/runtime/Memory.java similarity index 94% rename from classlib/src/main/java/org/teavm/classlib/impl/c/Memory.java rename to core/src/main/java/org/teavm/backend/c/runtime/Memory.java index 5520743c6..19545470e 100644 --- a/classlib/src/main/java/org/teavm/classlib/impl/c/Memory.java +++ b/core/src/main/java/org/teavm/backend/c/runtime/Memory.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 Alexey Andreev. + * Copyright 2022 Alexey Andreev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.impl.c; +package org.teavm.backend.c.runtime; import org.teavm.interop.Address; import org.teavm.interop.Import; diff --git a/classlib/src/main/java/org/teavm/classlib/impl/c/StringList.java b/core/src/main/java/org/teavm/backend/c/runtime/StringList.java similarity index 91% rename from classlib/src/main/java/org/teavm/classlib/impl/c/StringList.java rename to core/src/main/java/org/teavm/backend/c/runtime/StringList.java index aac505747..8c596be57 100644 --- a/classlib/src/main/java/org/teavm/classlib/impl/c/StringList.java +++ b/core/src/main/java/org/teavm/backend/c/runtime/StringList.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 Alexey Andreev. + * Copyright 2022 Alexey Andreev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.impl.c; +package org.teavm.backend.c.runtime; import org.teavm.interop.Structure; diff --git a/classlib/src/main/java/org/teavm/classlib/fs/c/CFileSystem.java b/core/src/main/java/org/teavm/backend/c/runtime/fs/CFileSystem.java similarity index 96% rename from classlib/src/main/java/org/teavm/classlib/fs/c/CFileSystem.java rename to core/src/main/java/org/teavm/backend/c/runtime/fs/CFileSystem.java index 375ecd902..2078a115c 100644 --- a/classlib/src/main/java/org/teavm/classlib/fs/c/CFileSystem.java +++ b/core/src/main/java/org/teavm/backend/c/runtime/fs/CFileSystem.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 Alexey Andreev. + * Copyright 2022 Alexey Andreev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,20 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.fs.c; +package org.teavm.backend.c.runtime.fs; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; import java.util.HashMap; import java.util.Map; import org.teavm.backend.c.intrinsic.RuntimeInclude; -import org.teavm.classlib.fs.VirtualFile; -import org.teavm.classlib.fs.VirtualFileSystem; -import org.teavm.classlib.impl.c.Memory; -import org.teavm.classlib.impl.c.StringList; +import org.teavm.backend.c.runtime.Memory; +import org.teavm.backend.c.runtime.StringList; import org.teavm.interop.Address; import org.teavm.interop.Import; import org.teavm.interop.Unmanaged; +import org.teavm.runtime.fs.VirtualFile; +import org.teavm.runtime.fs.VirtualFileSystem; public class CFileSystem implements VirtualFileSystem { private Map cache = new HashMap<>(); diff --git a/classlib/src/main/java/org/teavm/classlib/fs/c/CVirtualFile.java b/core/src/main/java/org/teavm/backend/c/runtime/fs/CVirtualFile.java similarity index 95% rename from classlib/src/main/java/org/teavm/classlib/fs/c/CVirtualFile.java rename to core/src/main/java/org/teavm/backend/c/runtime/fs/CVirtualFile.java index 98f7cce61..9757b3128 100644 --- a/classlib/src/main/java/org/teavm/classlib/fs/c/CVirtualFile.java +++ b/core/src/main/java/org/teavm/backend/c/runtime/fs/CVirtualFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 Alexey Andreev. + * Copyright 2022 Alexey Andreev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.fs.c; +package org.teavm.backend.c.runtime.fs; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.teavm.classlib.fs.VirtualFile; -import org.teavm.classlib.fs.VirtualFileAccessor; -import org.teavm.classlib.impl.c.Memory; -import org.teavm.classlib.impl.c.StringList; +import org.teavm.backend.c.runtime.Memory; +import org.teavm.backend.c.runtime.StringList; import org.teavm.interop.Address; +import org.teavm.runtime.fs.VirtualFile; +import org.teavm.runtime.fs.VirtualFileAccessor; public class CVirtualFile implements VirtualFile { CFileSystem fileSystem; diff --git a/classlib/src/main/java/org/teavm/classlib/fs/c/CVirtualFileAccessor.java b/core/src/main/java/org/teavm/backend/c/runtime/fs/CVirtualFileAccessor.java similarity index 95% rename from classlib/src/main/java/org/teavm/classlib/fs/c/CVirtualFileAccessor.java rename to core/src/main/java/org/teavm/backend/c/runtime/fs/CVirtualFileAccessor.java index fb68bcf6d..d7d952b63 100644 --- a/classlib/src/main/java/org/teavm/classlib/fs/c/CVirtualFileAccessor.java +++ b/core/src/main/java/org/teavm/backend/c/runtime/fs/CVirtualFileAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 Alexey Andreev. + * Copyright 2022 Alexey Andreev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.fs.c; +package org.teavm.backend.c.runtime.fs; import java.io.IOException; -import org.teavm.classlib.fs.VirtualFileAccessor; +import org.teavm.runtime.fs.VirtualFileAccessor; public class CVirtualFileAccessor implements VirtualFileAccessor { private long file; diff --git a/core/src/main/java/org/teavm/backend/c/transform/CFileSystemTransformer.java b/core/src/main/java/org/teavm/backend/c/transform/CFileSystemTransformer.java new file mode 100644 index 000000000..925589ae9 --- /dev/null +++ b/core/src/main/java/org/teavm/backend/c/transform/CFileSystemTransformer.java @@ -0,0 +1,30 @@ +/* + * Copyright 2022 Alexey Andreev. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.backend.c.transform; + +import org.teavm.backend.c.runtime.fs.CFileSystem; +import org.teavm.model.ClassHolderTransformerContext; +import org.teavm.model.MethodHolder; +import org.teavm.model.emit.ProgramEmitter; +import org.teavm.runtime.fs.VirtualFileSystemProviderTransformer; + +public class CFileSystemTransformer extends VirtualFileSystemProviderTransformer { + @Override + protected void transformCreateMethod(MethodHolder method, ClassHolderTransformerContext context) { + ProgramEmitter pe = ProgramEmitter.create(method, context.getHierarchy()); + pe.construct(CFileSystem.class).returnValue(); + } +} diff --git a/classlib/src/main/java/org/teavm/classlib/fs/VirtualFile.java b/core/src/main/java/org/teavm/runtime/fs/VirtualFile.java similarity index 94% rename from classlib/src/main/java/org/teavm/classlib/fs/VirtualFile.java rename to core/src/main/java/org/teavm/runtime/fs/VirtualFile.java index 54b627182..6e4cede88 100644 --- a/classlib/src/main/java/org/teavm/classlib/fs/VirtualFile.java +++ b/core/src/main/java/org/teavm/runtime/fs/VirtualFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 Alexey Andreev. + * Copyright 2022 Alexey Andreev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.fs; +package org.teavm.runtime.fs; import java.io.IOException; diff --git a/classlib/src/main/java/org/teavm/classlib/fs/VirtualFileAccessor.java b/core/src/main/java/org/teavm/runtime/fs/VirtualFileAccessor.java similarity index 94% rename from classlib/src/main/java/org/teavm/classlib/fs/VirtualFileAccessor.java rename to core/src/main/java/org/teavm/runtime/fs/VirtualFileAccessor.java index 531778e14..70edfc24e 100644 --- a/classlib/src/main/java/org/teavm/classlib/fs/VirtualFileAccessor.java +++ b/core/src/main/java/org/teavm/runtime/fs/VirtualFileAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 Alexey Andreev. + * Copyright 2022 Alexey Andreev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.fs; +package org.teavm.runtime.fs; import java.io.IOException; diff --git a/classlib/src/main/java/org/teavm/classlib/fs/VirtualFileSystem.java b/core/src/main/java/org/teavm/runtime/fs/VirtualFileSystem.java similarity index 91% rename from classlib/src/main/java/org/teavm/classlib/fs/VirtualFileSystem.java rename to core/src/main/java/org/teavm/runtime/fs/VirtualFileSystem.java index e7b8896f6..3cd5f1f9f 100644 --- a/classlib/src/main/java/org/teavm/classlib/fs/VirtualFileSystem.java +++ b/core/src/main/java/org/teavm/runtime/fs/VirtualFileSystem.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 Alexey Andreev. + * Copyright 2022 Alexey Andreev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.fs; +package org.teavm.runtime.fs; public interface VirtualFileSystem { String getUserDir(); diff --git a/classlib/src/main/java/org/teavm/classlib/fs/VirtualFileSystemProvider.java b/core/src/main/java/org/teavm/runtime/fs/VirtualFileSystemProvider.java similarity index 71% rename from classlib/src/main/java/org/teavm/classlib/fs/VirtualFileSystemProvider.java rename to core/src/main/java/org/teavm/runtime/fs/VirtualFileSystemProvider.java index 7a49fe185..8401ee637 100644 --- a/classlib/src/main/java/org/teavm/classlib/fs/VirtualFileSystemProvider.java +++ b/core/src/main/java/org/teavm/runtime/fs/VirtualFileSystemProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 Alexey Andreev. + * Copyright 2022 Alexey Andreev. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,30 +13,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.fs; +package org.teavm.runtime.fs; -import org.teavm.classlib.PlatformDetector; -import org.teavm.classlib.fs.c.CFileSystem; -import org.teavm.classlib.fs.memory.InMemoryVirtualFileSystem; +import org.teavm.runtime.fs.memory.InMemoryVirtualFileSystem; public final class VirtualFileSystemProvider { private static VirtualFileSystem instance; - static { - if (PlatformDetector.isC()) { - instance = new CFileSystem(); - } else { - instance = new InMemoryVirtualFileSystem(); - } - } - private VirtualFileSystemProvider() { } public static VirtualFileSystem getInstance() { + if (instance == null) { + instance = create(); + } return instance; } + private static VirtualFileSystem create() { + return new InMemoryVirtualFileSystem(); + } + public static void setInstance(VirtualFileSystem instance) { VirtualFileSystemProvider.instance = instance; } diff --git a/core/src/main/java/org/teavm/runtime/fs/VirtualFileSystemProviderTransformer.java b/core/src/main/java/org/teavm/runtime/fs/VirtualFileSystemProviderTransformer.java new file mode 100644 index 000000000..692bfc33a --- /dev/null +++ b/core/src/main/java/org/teavm/runtime/fs/VirtualFileSystemProviderTransformer.java @@ -0,0 +1,34 @@ +/* + * Copyright 2022 Alexey Andreev. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.teavm.runtime.fs; + +import org.teavm.model.ClassHolder; +import org.teavm.model.ClassHolderTransformer; +import org.teavm.model.ClassHolderTransformerContext; +import org.teavm.model.MethodDescriptor; +import org.teavm.model.MethodHolder; + +public abstract class VirtualFileSystemProviderTransformer implements ClassHolderTransformer { + @Override + public void transformClass(ClassHolder cls, ClassHolderTransformerContext context) { + if (cls.getName().equals(VirtualFileSystemProvider.class.getName())) { + MethodHolder method = cls.getMethod(new MethodDescriptor("create", VirtualFileSystem.class)); + transformCreateMethod(method, context); + } + } + + protected abstract void transformCreateMethod(MethodHolder method, ClassHolderTransformerContext context); +} diff --git a/classlib/src/main/java/org/teavm/classlib/fs/memory/AbstractInMemoryVirtualFile.java b/core/src/main/java/org/teavm/runtime/fs/memory/AbstractInMemoryVirtualFile.java similarity index 96% rename from classlib/src/main/java/org/teavm/classlib/fs/memory/AbstractInMemoryVirtualFile.java rename to core/src/main/java/org/teavm/runtime/fs/memory/AbstractInMemoryVirtualFile.java index 1bf49346a..d9cb145c2 100644 --- a/classlib/src/main/java/org/teavm/classlib/fs/memory/AbstractInMemoryVirtualFile.java +++ b/core/src/main/java/org/teavm/runtime/fs/memory/AbstractInMemoryVirtualFile.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.fs.memory; +package org.teavm.runtime.fs.memory; import java.io.IOException; -import org.teavm.classlib.fs.VirtualFileAccessor; +import org.teavm.runtime.fs.VirtualFileAccessor; public abstract class AbstractInMemoryVirtualFile { String name; diff --git a/classlib/src/main/java/org/teavm/classlib/fs/memory/InMemoryVirtualDirectory.java b/core/src/main/java/org/teavm/runtime/fs/memory/InMemoryVirtualDirectory.java similarity index 97% rename from classlib/src/main/java/org/teavm/classlib/fs/memory/InMemoryVirtualDirectory.java rename to core/src/main/java/org/teavm/runtime/fs/memory/InMemoryVirtualDirectory.java index 3e8f39ea7..d56daa55f 100644 --- a/classlib/src/main/java/org/teavm/classlib/fs/memory/InMemoryVirtualDirectory.java +++ b/core/src/main/java/org/teavm/runtime/fs/memory/InMemoryVirtualDirectory.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.fs.memory; +package org.teavm.runtime.fs.memory; import java.io.IOException; import java.util.LinkedHashMap; import java.util.Map; -import org.teavm.classlib.fs.VirtualFileAccessor; +import org.teavm.runtime.fs.VirtualFileAccessor; public class InMemoryVirtualDirectory extends AbstractInMemoryVirtualFile { final Map children = new LinkedHashMap<>(); diff --git a/classlib/src/main/java/org/teavm/classlib/fs/memory/InMemoryVirtualFile.java b/core/src/main/java/org/teavm/runtime/fs/memory/InMemoryVirtualFile.java similarity index 97% rename from classlib/src/main/java/org/teavm/classlib/fs/memory/InMemoryVirtualFile.java rename to core/src/main/java/org/teavm/runtime/fs/memory/InMemoryVirtualFile.java index b10d067cd..e5b8eec55 100644 --- a/classlib/src/main/java/org/teavm/classlib/fs/memory/InMemoryVirtualFile.java +++ b/core/src/main/java/org/teavm/runtime/fs/memory/InMemoryVirtualFile.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.fs.memory; +package org.teavm.runtime.fs.memory; import java.io.IOException; import java.util.Arrays; -import org.teavm.classlib.fs.VirtualFileAccessor; +import org.teavm.runtime.fs.VirtualFileAccessor; public class InMemoryVirtualFile extends AbstractInMemoryVirtualFile { byte[] data = new byte[0]; diff --git a/classlib/src/main/java/org/teavm/classlib/fs/memory/InMemoryVirtualFileSystem.java b/core/src/main/java/org/teavm/runtime/fs/memory/InMemoryVirtualFileSystem.java similarity index 90% rename from classlib/src/main/java/org/teavm/classlib/fs/memory/InMemoryVirtualFileSystem.java rename to core/src/main/java/org/teavm/runtime/fs/memory/InMemoryVirtualFileSystem.java index c760d2032..8fe5421c4 100644 --- a/classlib/src/main/java/org/teavm/classlib/fs/memory/InMemoryVirtualFileSystem.java +++ b/core/src/main/java/org/teavm/runtime/fs/memory/InMemoryVirtualFileSystem.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.fs.memory; +package org.teavm.runtime.fs.memory; -import org.teavm.classlib.fs.VirtualFile; -import org.teavm.classlib.fs.VirtualFileSystem; +import org.teavm.runtime.fs.VirtualFile; +import org.teavm.runtime.fs.VirtualFileSystem; public class InMemoryVirtualFileSystem implements VirtualFileSystem { InMemoryVirtualDirectory root = new InMemoryVirtualDirectory(""); diff --git a/classlib/src/main/java/org/teavm/classlib/fs/memory/VirtualFileImpl.java b/core/src/main/java/org/teavm/runtime/fs/memory/VirtualFileImpl.java similarity index 97% rename from classlib/src/main/java/org/teavm/classlib/fs/memory/VirtualFileImpl.java rename to core/src/main/java/org/teavm/runtime/fs/memory/VirtualFileImpl.java index 988af912b..7fb6280cb 100644 --- a/classlib/src/main/java/org/teavm/classlib/fs/memory/VirtualFileImpl.java +++ b/core/src/main/java/org/teavm/runtime/fs/memory/VirtualFileImpl.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.teavm.classlib.fs.memory; +package org.teavm.runtime.fs.memory; import java.io.IOException; -import org.teavm.classlib.fs.VirtualFile; -import org.teavm.classlib.fs.VirtualFileAccessor; +import org.teavm.runtime.fs.VirtualFile; +import org.teavm.runtime.fs.VirtualFileAccessor; public class VirtualFileImpl implements VirtualFile { private InMemoryVirtualFileSystem fs;