PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: RhodyRich on September 17, 2009, 12:06:55 PM

Title: PATHNAME$ -- inconsistent results
Post by: RhodyRich on September 17, 2009, 12:06:55 PM
I'm not sure if this is a Power Basic or a FireFly issue. I've posted it on the PB forums, too.

I am getting a strange result using the PATHNAME$ function.

X$ = "C:\Temp\Test.cfg"

PATHNAME$(NAME, X$) most often returns "Test" but sometimes returns "Test.cfg"

I cannot determine why this does not work reliably. Any ideas?

More detail. The actual X$ is being filled when I am doing a SAVE AS file function.

Flags = %OFN_CREATEPROMPT OR %OFN_NOTESTFILECREATE OR %OFN_PATHMUSTEXIST OR %OFN_OVERWRITEPROMPT OR %OFN_LONGNAMES OR %OFN_EXPLORER
LL = FF_SAVEFILEDIALOG( HWND_MAINFORM, DTitle$, DFile$, DPath$, DFilter$, DExt$, Flags, %True)

The string value used with PATHNAME$ is DFile$.

If the SAVE AS is to the current folder, then PATHNAME$ works fine. If the SAVE AS is to a new folder, then PATHNAME$ returns the file name with the extension. Happens every time. Could there be an invisible character in X$ that is causing this problem? Msgbox display shows that the length of the X$ string is correct and it displays as expected. This is driving me crazy.

MORE INFO:

This is most likely a Vista issue. The code works fine if I don't save to C:\temp folder. I can live with that but I would like some way to know that the folder a user selects will or will not be appropriate. I thought perhaps the OFN_NOREADONLYRETURN flag would do this for me but it does not help.

When I check the properties of the C:\temp folder it comes up with "Read only" checked although I can copy files to the folder using Explorer. It lets me uncheck the read only box and apply the change but the change does not stick.

Any suggestions?