https://linen.dev logo
Join Discord
Powered by
# haxe-ui
  • b

    bright-gpu-74537

    10/02/2019, 2:35 PM
    so if thats the case, maybe we need (as you said originally) something like this for the path resolution:
  • b

    bright-gpu-74537

    10/02/2019, 2:35 PM
    Copy code
    haxe
                        try { 
                            resolvedPath = Context.resolvePath(r.path); 
                        } catch (e:Dynamic) { 
                            resolvedPath = haxe.io.Path.join([Sys.getCwd(), r.path]); 
                        } 
                        if (FileSystem.isDirectory(resolvedPath) && FileSystem.exists(resolvedPath)) {
                            addResources(resolvedPath, resolvedPath, r.prefix);
                        } else {
                            trace("WARNING: Could not find path " + resolvedPath);
                        }
  • u

    user

    10/02/2019, 2:38 PM
    heres what I have```if (c.classFolder != null) { if(FileSystem.exists(c.classFolder)){ createDynamicClasses(c.classFolder); } else{ var isValid = false; for(i in m.resourceEntries){ isValid = c.classFolder == i.prefix; if(isValid){ createDynamicClasses(Context.resolvePath(i.path)); break; } } if(!isValid) throw c.classFolder +" is not a valid path or resource prefix"; } } else if (c.classFile != null) { if(FileSystem.exists(c.classFile)){ createDynamicClass(c.classFile, c.classAlias); } else{ var isValid = false; var prefix = c.classFile.split("/"); for(i in m.resourceEntries){ isValid = prefix[0] == i.prefix; if(isValid){ createDynamicClass(Context.resolvePath(i.path+prefix[1]),c.classAlias); break; } } if(!isValid) throw c.classFile +" is not a valid absolute path or resource prefix"; } ```
  • u

    user

    10/02/2019, 2:38 PM
    euh its ugly in in discord
  • b

    bright-gpu-74537

    10/02/2019, 2:39 PM
    gotta be a simpler way, no?
  • u

    user

    10/02/2019, 2:40 PM
    probably; 😛
  • b

    bright-gpu-74537

    10/02/2019, 2:42 PM
    can you do me a favour and try and add this at the start of the "createDynamicClasses" function
  • b

    bright-gpu-74537

    10/02/2019, 2:43 PM
    Copy code
    haxe
            var resolvedPath = null;
            try { 
                resolvedPath = Context.resolvePath(dir); 
            } catch (e:Dynamic) { 
                resolvedPath = haxe.io.Path.join([Sys.getCwd(), dir]); 
            } 
            if (resolvedPath == null || FileSystem.exists(resolvedPath) == false) {
                trace("WARNING: Could not find path " + resolvedPath);
            }
            
            dir = resolvedPath;
  • b

    bright-gpu-74537

    10/02/2019, 2:43 PM
    and this at the start of the "createDynamicClass" function:
  • b

    bright-gpu-74537

    10/02/2019, 2:43 PM
    Copy code
    haxe
            var resolvedPath = null;
            try { 
                resolvedPath = Context.resolvePath(filePath); 
            } catch (e:Dynamic) { 
                resolvedPath = haxe.io.Path.join([Sys.getCwd(), filePath]); 
            } 
            if (resolvedPath == null || FileSystem.exists(resolvedPath) == false) {
                trace("WARNING: Could not find path " + resolvedPath);
            }
            
            filePath = resolvedPath;
  • b

    bright-gpu-74537

    10/02/2019, 2:43 PM
    that work?
  • u

    user

    10/02/2019, 2:44 PM
    will try
  • b

    bright-gpu-74537

    10/02/2019, 2:44 PM
    thanks!
  • u

    user

    10/02/2019, 2:48 PM
    yeah the Sys.cwd will try getting the directory in the project using the lib so it wont work
  • b

    bright-gpu-74537

    10/02/2019, 2:49 PM
    OK, and Context.resolvePath doesnt resolve it?
  • u

    user

    10/02/2019, 2:50 PM
    nope
  • b

    bright-gpu-74537

    10/02/2019, 2:50 PM
    i wonder why... works for resources
  • b

    bright-gpu-74537

    10/02/2019, 2:50 PM
    lemme create a dummy lib and see about this
  • u

    user

    10/02/2019, 2:52 PM
    it works because you use the path to the resourceEntries
  • b

    bright-gpu-74537

    10/02/2019, 2:53 PM
    "c:.temp.dummy_haxelib.assets.morecustomcomponents" is not a valid package name:[
  • b

    bright-gpu-74537

    10/02/2019, 2:53 PM
    :/
  • u

    user

    10/02/2019, 2:53 PM
    (basically what I was doing in the code I showed you) I could try to do it like you did
  • b

    bright-gpu-74537

    10/02/2019, 2:55 PM
    ok, i think i see what the issue is... its that the resolvePath is then giving an abosulte path, which for resources is exactly what we are after....
  • b

    bright-gpu-74537

    10/02/2019, 2:55 PM
    but for xml classes, not so much as then were are trying to make a name out of that
  • u

    user

    10/02/2019, 2:56 PM
    would this be more acceptable:
    Copy code
    var resolvedPath = null;
                        try { 
                            resolvedPath = Context.resolvePath(c.classFolder); 
                        } catch (e:Dynamic) { 
                            for(i in m.resourceEntries){
                                if(c.classFolder == i.prefix){
                                    resolvedPath = Context.resolvePath(i.path);
                                    break;
                                }
                            }
                            
                        } 
                        if (resolvedPath == null || FileSystem.exists(resolvedPath) == false) {
                            trace("WARNING: Could not find path " + resolvedPath);
                        }
                        createDynamicClasses(resolvedPath);
  • b

    bright-gpu-74537

    10/02/2019, 2:58 PM
    i think i got a better way... ... maybe
  • b

    bright-gpu-74537

    10/02/2019, 2:58 PM
    (i dont really want to rely on the resourceEntries basically)
  • u

    user

    10/02/2019, 2:59 PM
    oh ok;
  • u

    user

    10/02/2019, 3:02 PM
    I can test whenever you have the fix
  • b

    bright-gpu-74537

    10/02/2019, 3:03 PM
    great... just about to commit
1...124125126...1687Latest