processing / processing/processing4
sketchPath is different on OSX then Windows
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 497
- フォーク
- 183
- 平均マージ
- 4時間 39分
- マージ済み PR(30日)
- 3
説明
Created by: clankill3r
Processing 4.3 (and prior)
Windows 10
When working outside the IDE it's common to put the libraries in a lib folder like: (even when not using processing this is common)
The above works fine on OSX, but on windows it does not work.
The reason it breaks on windows: https://github.com/benfry/processing4/blob/main/core/src/processing/core/PApplet.java#L7186
if (jarPath.contains("/lib/")) {
// Windows or Linux, back up a directory to get the executable
folder = new File(jarPath, "../..").getCanonicalPath();
}
It is assumed that core.jar is directly in the lib folder, in the above case sketchPath becomes rootOfProject/lib and dataPath becomes rootOfProject/lib/data.
For now I use this in my sketch:
public void fixSketchPath() {
try {
Field sketchPathField = PApplet.class.getDeclaredField("sketchPath");
sketchPathField.setAccessible(true);
String sketchPath = (String) sketchPathField.get(this);
if (sketchPath.contains("\\lib")) {
int libIndex = sketchPath.indexOf("\\lib");
sketchPath = sketchPath.substring(0, libIndex);
}
sketchPathField.set(this, sketchPath);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
}
But this is of course more a work around then a fix.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
core/src/processing/core/PApplet.java の、リンクされた行付近にある sketchPath のロジックから始め、Windows 10 と OSX で jarPath がどのように扱われるかを比較してください。ライブラリを lib フォルダーに置く構成を再現し、sketchPath が lib フォルダーではなくプロジェクトルートを指し、dataPath がそのルートから導出されることを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- operating-systems
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100