processing / processing/processing4
sketchPath is different on OSX then Windows
Personne n'a encore pris cette issue.
- Langage dominant
- Java
- Étoiles
- 494
- Forks
- 183
- Merge moyen
- 4 h 39 min
- PR mergées (30 j)
- 3
Description
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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez dans core/src/processing/core/PApplet.java, au niveau de la logique de sketchPath autour de la ligne liée, et comparez la manière dont jarPath est géré sous Windows 10 par rapport à OSX. Reproduisez la configuration d’une bibliothèque dans un dossier lib et vérifiez que sketchPath pointe vers la racine du projet plutôt que vers le dossier lib, avec dataPath dérivé de cette racine.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- operating-systems
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100