New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expandPath() returning invalid directory when a trailing "/" is present on ACF11 and FW/1 3.5 #336

Closed
tonyjunkes opened this Issue Jun 4, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@tonyjunkes
Member

tonyjunkes commented Jun 4, 2015

This is in reference to this post: https://groups.google.com/d/msg/framework-one/I1FuQupK9_A/UH5au0CpVpEJ

Given the code below (found in ioclj.cfc: line 181),

When trying to run the FW/1 3.5 example: 6helloclojure, the variable: expandedFolder is returning an invalid directory as index.cfm is being appended to the end of the path when expandPath( folder ) is called. Further investigation is showing that when a trailing / is omitted/removed from the path supplied to expandPath(), a valid directory path is generated.

private string function findProjectFile( array folders ) {
    for ( var folder in folders ) {
        var expandedFolder = expandPath( folder );
        // for ACF11 compatibility, only use expanded path if it exists
        if ( directoryExists( expandedFolder ) ) folder = expandedFolder;
        if ( !directoryExists( folder ) ) continue;
        var path = replace( folder, chr(92), "/", "all" );
        if ( right( path, 1 ) == "/" ) {
            if ( len( path ) == 1 ) path = "";
            else path = left( path, len( path ) - 1 );
        }
        if ( fileExists( path & "/project.clj" ) ) {
            // found our Clojure project, return it
            if ( variables.debug ) variables.stdout.println( "ioclj: using #path#/project.clj for Clojure root" );
            return path;
        }
    }
    throw "Unable to find project.clj in any of: #arrayToList( folders, ', ' )#";
}

A potential solution can be found in the link above. At this time, I haven't been able to reproduce a similar scenario with expandPath() outside of trying to run the 6helloclojure example code.

@seancorfield seancorfield added this to the 3.5 milestone Jun 4, 2015

@seancorfield

This comment has been minimized.

Show comment
Hide comment
@seancorfield

seancorfield Jun 4, 2015

Member

Fixed in 351c1f3 as part of an enhancement to allow arrays of paths as well as lists.

Member

seancorfield commented Jun 4, 2015

Fixed in 351c1f3 as part of an enhancement to allow arrays of paths as well as lists.

@tonyjunkes

This comment has been minimized.

Show comment
Hide comment
@tonyjunkes

tonyjunkes Jun 4, 2015

Member

Works like a charm. Thanks!

Member

tonyjunkes commented Jun 4, 2015

Works like a charm. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment