getDirectoryFromPath returns different result to Lucee and ACF

Description

Found whilst trying to run a FW1 app.

Example code: Application.cfc

component { function onRequestStart( string targetPage ) { writeDump( getDirectoryFromPath( "/index.cfm" ) ); abort; } }

Lucee (and ACF) prints out:

string /

BoxLang prints out:

String [52]: /Users/johnwhish/projects/jericho/fw1gettingstarted/

For reference, this where the issue occurs in FW1 which prevents it finding views and controllers https://github.com/framework-one/fw1/blob/develop/framework/one.cfc#L2535

Activity

Show:

Brad Wood January 28, 2025 at 10:52 PM

Ok, this BIF should be returned to its former glory.

Brad Wood January 28, 2025 at 10:45 PM

Ahh, looks like it fell victim to this commit
https://github.com/ortus-boxlang/BoxLang/commit/84a264ce526dde0eb22f3980d169b6b62f3d9773

which was a mostly-blind pass over every file system related BIF to expand all their inputs. I think this logic was just added in error in this specific BIF’s case. cc/

Brad Wood January 28, 2025 at 10:43 PM
Edited

Ooh, tricky. I’m a little confused here since I thought that function was only ever used on absolute paths! Our Java implementation of this BIF starts with this code

String path = FileSystemUtil.expandPath( context, arguments.getAsString( Key.path ) ).absolutePath().toString();

which explicitly expands it! I’ll have to try and remember why we were doing that and figure out what may break when I remove it.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Fix versions

Priority

Sentry

Created January 28, 2025 at 9:15 PM
Updated January 28, 2025 at 10:52 PM
Resolved January 28, 2025 at 10:52 PM