From f07d1aef4346ede0400da84fd1c6c2de9f44835d Mon Sep 17 00:00:00 2001 From: Nathan Sweet Date: Fri, 28 Jan 2022 17:50:05 -0400 Subject: [PATCH] [libgdx] Skeleton Viewer, use canonical path. Windows will give a short 8.3 path if the path is very long, then the ".json" extension becomes ".jso". --- .../com/esotericsoftware/spine/SkeletonViewer.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java b/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java index bc2afb4cf..fd0c13f5e 100644 --- a/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java +++ b/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java @@ -119,8 +119,15 @@ public class SkeletonViewer extends ApplicationAdapter { } } - boolean loadSkeleton (final @Null FileHandle skeletonFile) { + boolean loadSkeleton (@Null FileHandle skeletonFile) { if (skeletonFile == null) return false; + + try { + skeletonFile = new FileHandle(skeletonFile.file().getCanonicalFile()); + } catch (Throwable ex) { + skeletonFile = new FileHandle(skeletonFile.file().getAbsoluteFile()); + } + FileHandle oldSkeletonFile = this.skeletonFile; this.skeletonFile = skeletonFile; reloadTimer = 0; @@ -139,7 +146,7 @@ public class SkeletonViewer extends ApplicationAdapter { skeletonData = loader.readSkeletonData(skeletonFile); if (skeletonData.getBones().size == 0) throw new Exception("No bones in skeleton data."); } catch (Throwable ex) { - System.out.println("Error loading skeleton: " + skeletonFile.file().getAbsolutePath()); + System.out.println("Error loading skeleton: " + skeletonFile.path()); ex.printStackTrace(); ui.toast("Error loading skeleton: " + skeletonFile.name()); this.skeletonFile = oldSkeletonFile;