processing / processing/processing4

sketchPath is different on OSX then Windows

Abierto
#808 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug core has attachment
Lenguaje dominante
Java
Estrellas
494
Forks
183
Merge medio
4 h 39 min
PR fusionados (30 d)
3

Descripción

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)

sketchPath

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza en core/src/processing/core/PApplet.java, en la lógica de sketchPath alrededor de la línea enlazada, y compara cómo se gestiona jarPath en Windows 10 frente a OSX. Reproduce la configuración de una biblioteca en una carpeta lib y verifica que sketchPath apunte a la raíz del proyecto en lugar de a la carpeta lib, con dataPath derivado de esa raíz.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java
Área
operating-systems
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.