Create a copy files step for the .gif and specify its placement into the Resources folder. Then you can access it like this in an HTMLviewer:
dim f As FolderItem = app.ExecutableFile.Parent.Parent.Child("Resources").Child("FILE NAME.gif")
dim s as string = ReplaceAll(f.NativePath, " ", "%20")
HTMLViewer1.LoadURL("file://"+s)
This is what I use on my Mac, if you are doing windows the path to the file might have to be changed.
Cool! That works great on a Mac. Now I need to get it working on Windows. I’m familiar with the internal package structure of a Mac App Bundle, but not the path of an EXE.
dim f As FolderItem
#if TargetMacOS
f = app.ExecutableFile.Parent.Parent.Child("Resources").Child("FILE NAME.gif")
#else
f = app.ExecutableFile.Parent.Child("Resources").Child("FILE NAME.gif")
#endif
dim s as string = ReplaceAll(f.NativePath, " ", "%20")
HTMLViewer1.LoadURL("file://"+s)
[quote=59848:@shao sean] dim f As FolderItem
#if TargetMacOS
f = app.ExecutableFile.Parent.Parent.Child("Resources").Child("FILE NAME.gif")
#else
f = app.ExecutableFile.Parent.Child("Resources").Child("FILE NAME.gif")
#endif
dim s as string = ReplaceAll(f.NativePath, " ", "%20")
HTMLViewer1.LoadURL("file://"+s)
[/quote]
I get an exception of class nilobjectexception on Windows when I use that code.
Even if I copy the pic using that path provided, (and not even trying to load it in html viewer) I still get the same error on Windows. I think the path shao sean provided isn’t correct for a Windows exe.
Copyright a file into the executable Folder isn’t a option. This might work o. your developer PC but Most Users don’t work as privileged or admin users. On both Mac and Windows you cannot put anything into your app folder anymore. Use Users or system temp Folder instead.
[quote=59935:@Michel Bujardet]The path for the Windows app is :
f = app.ExecutableFile.Parent.Child("FILENAME.gif")
Just copy FILENAME.gif in the same directory as your application exe.[/quote]
Well, no error anymore, but no file either. This code works perfectly on Mac OS X, but copies no file on Windows.
[code] dim f As FolderItem #if TargetMacOS
f = app.ExecutableFile.Parent.Parent.Child(“Resources”).Child(“Ladies.gif”) #else
f = app.ExecutableFile.Parent.Child(“Ladies.gif”) #endif
dim dir as FolderItem
dir = SpecialFolder.desktop
f.copyfileto (dir)[/code]