GetSaveFolderItem not popping up

I tried this code and the “save as” dialog wouldn’t show - no errors, just nothing.
It turned out to be a simple thing - thought I would post it here in case someone else has the same problem.
Watch out for illegal characters in the suggested file name. In this case, colons.

Wouldn’t work:


dim d as new date
dim fn As String="Requests "+d.SQLDateTime
dim f As FolderItem=GetSaveFolderItem(TextFileTypes.all,fn)

Worked:


dim d as new date
dim fn As String=“Requests “+ReplaceAll(d.SQLDateTime,”:”,"-")
dim f As FolderItem=GetSaveFolderItem(TextFileTypes.all,fn)

I have now moved to NativePath names, but I wrote this to help with cross-platform filenames:

[quote]Function getCompatibleFileName(myFileName As String) As String
Dim tempString As String = myFileName

if myFileName = “” then Return “”

#if TargetMacOS then
tempString = ReplaceAll(tempString, “:”, “-”)
#elseif TargetWin32 then
tempString = ReplaceAll(tempString, “/”, “-”)
tempString = ReplaceAll(tempString, “:”, “-”)
#elseif TargetLinux then
tempString = ReplaceAll(tempString, “”, “-”)
tempString = ReplaceAll(tempString, “:”, “-”)
#endif

Return tempString

End Function
[/quote]

I also found out that on MacOS the .NativePath changes the ‘/’ text in folder names, but not in filenames — in case you move from AbsolutePath to NativePath like me. I use FolderItem.Child(“…”) where I can, but NativePath when storing a path in a preference file.

Hi James:

is the ‘-’ character allowed on Windows ?
(the Windows you are runnoing on)

also:

Have you read FolderItem.NativePath ?

Warning, there is something wrong at the end of the Notes sentence.

Yes, you can definitely use the ‘-’ in filenames on Windows. I assume that the hyphen is also okay in folder names as well, but I haven’t tested this.

Emile :

http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/dd317748(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/aa493942(v=EXCHG.80).aspx

For all things Windows, msdn.microsoft.com is the equivalent of the Mac Developper Library.

Merci.