Bug? xui.FileUri not 100% crossplatform due to missing traling slash

sorex

Expert
Licensed User
Longtime User
Hello,

I notice that I still need to use OS depending code exeptions while using

B4X:
xui.FileUri(file.dirAssets,"")

the reason is that the B4A result has a trailing slash but B4i doesn't.

Can this be normalized so that both results are the same (both with or without trailing slash)?
 
Last edited:

sorex

Expert
Licensed User
Longtime User
I'm using a webview based "how to play" screen with local images.

The current code to update the html with the right path is this...

B4X:
#if B4A
    html=html.Replace("[path]",xui.FileUri(dirAssets,"") )      'has trailing /
#else
    html=html.Replace("[path]",xui.FileUri(dirAssets,"") & "/") 'add trailing /
#end if
 
Last edited:

sorex

Expert
Licensed User
Longtime User
After upgrading to the B4A 8.80 beta the above suddenly doesn't work anymore.
I'm not sure if it is due to a change in the Xui library or somewhere else.

I'm using this as workaround which is more safe as it uses a filename and due to the dropping of the conditional lines it's the same amount of lines aswell.

B4X:
Dim path As String
path=xui.FileUri(dirAssets,"info.png")   'just point to a valid asset file instead of the previous "" 'hack'
path=path.SubString2(0,path.LastIndexOf("/")) 'strip off the filename and leading / again
html=html.Replace("[path]",path)
 
Last edited:
Top