Skip to content

Commit 006311d

Browse files
committed
fixed problem with saving some files.
1 parent c51d011 commit 006311d

File tree

6 files changed

+8
-33
lines changed

6 files changed

+8
-33
lines changed

build-native.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180

181181
<fx:platform>
182182
<fx:jvmarg value="-XX:+UseParallelGC"/>
183-
<!--<fx:jvmarg value="-agentlib:jdwp=transport=dt_socket,server=n,address=javasabr-NB:6005,suspend=y"/>-->
183+
<!--<fx:jvmarg value="-agentlib:jdwp=transport=dt_socket,server=n,address=localhost:6005,suspend=y"/>-->
184184
</fx:platform>
185185

186186
<preferences shortcut="true" menu="true" install="false"/>

src/main/java/com/ss/editor/JmeApplication.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.jme3.app.DebugKeysAppState;
1010
import com.jme3.asset.AssetManager;
1111
import com.jme3.asset.AssetNotFoundException;
12+
import com.jme3.asset.plugins.ClasspathLocator;
1213
import com.jme3.audio.AudioRenderer;
1314
import com.jme3.audio.Environment;
1415
import com.jme3.bounding.BoundingSphere;
@@ -276,8 +277,11 @@ public void simpleInitApp() {
276277
LOGGER.debug(this, "OS: " + system.getDistribution());
277278

278279
final AssetManager assetManager = getAssetManager();
280+
assetManager.unregisterLocator("", ClasspathLocator.class);
281+
assetManager.unregisterLocator("/", ClasspathLocator.class);
279282
assetManager.registerLocator("", FolderAssetLocator.class);
280283
assetManager.registerLocator("", FileSystemAssetLocator.class);
284+
assetManager.registerLocator("", ClasspathLocator.class);
281285
assetManager.addAssetEventListener(EditorConfig.getInstance());
282286

283287
final AudioRenderer audioRenderer = getAudioRenderer();

src/main/java/com/ss/editor/manager/ResourceManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,16 @@ public synchronized void assetRequested(@NotNull final AssetKey key) {
283283
return;
284284
}
285285

286-
final Path assetFile = getRealFile(Paths.get(key.getName()));
287-
if (assetFile == null || !Files.exists(assetFile)) {
286+
final Path realFile = getRealFile(Paths.get(key.getName()));
287+
if (realFile == null || !Files.exists(realFile)) {
288288
return;
289289
}
290290

291291
try {
292292

293293
final long timestamp = reference.getLong();
294294

295-
final FileTime lastModifiedTime = Files.getLastModifiedTime(assetFile);
295+
final FileTime lastModifiedTime = Files.getLastModifiedTime(realFile);
296296
if (lastModifiedTime.to(TimeUnit.MILLISECONDS) <= timestamp) {
297297
return;
298298
}

src/main/java/com/ss/editor/ui/component/editor/impl/AbstractFileEditor.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -388,23 +388,6 @@ public void save(@Nullable final Consumer<@NotNull FileEditor> callback) {
388388
*/
389389
@BackgroundThread
390390
protected void doSave(@NotNull final Path toStore) throws IOException {
391-
392-
final Path assetFile = notNull(EditorUtil.getAssetFile(getEditFile()));
393-
final String assetPath = EditorUtil.toAssetPath(assetFile);
394-
395-
EditorUtil.getAssetManager()
396-
.deleteFromCache(getFileKey(assetPath));
397-
}
398-
399-
/**
400-
* Get an asset key to remove cache of this file.
401-
*
402-
* @param assetPath the asset path.
403-
* @return the asset key.
404-
*/
405-
@FromAnyThread
406-
protected @NotNull AssetKey<?> getFileKey(@NotNull final String assetPath) {
407-
return new ModelKey(assetPath);
408391
}
409392

410393
/**

src/main/java/com/ss/editor/ui/component/editor/impl/material/MaterialFileEditor.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,6 @@ public void doSave(@NotNull final Path toStore) throws IOException {
134134
}
135135
}
136136

137-
@Override
138-
@FromAnyThread
139-
protected @NotNull AssetKey<?> getFileKey(@NotNull final String assetPath) {
140-
return new MaterialKey(assetPath);
141-
}
142-
143137
@Override
144138
@FxThread
145139
protected void handleExternalChanges() {

src/main/java/com/ss/editor/ui/component/editor/impl/scene/AbstractSceneFileEditor.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -941,12 +941,6 @@ public void doSave(@NotNull final Path toStore) throws IOException {
941941
}
942942
}
943943

944-
@Override
945-
@FromAnyThread
946-
protected @NotNull AssetKey<?> getFileKey(@NotNull final String assetPath) {
947-
return new ModelKey(assetPath);
948-
}
949-
950944
@Override
951945
@FxThread
952946
protected boolean needToolbar() {

0 commit comments

Comments
 (0)