Spetial folders

BlitzMax Forums/BlitzMax Programming/Spetial folders

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Peter, your code isn't taking in cosideration the 0 end string returned by the API.
If function works fine like this:

Function GetSpecialFolder:String(folder_id) 
		
	Local  idl:TBank = CreateBank (8) 
	Local  pathbank:TBank = CreateBank (260) 
	Local n%
	Local sp$

	If SHGetSpecialFolderLocation(0,folder_id,BankBuf(idl)) = 0		
		SHGetPathFromIDList PeekInt( idl,0), BankBuf(pathbank)
		For n= 0 To 259
			local BufByte:byte =PeekByte(pathbank,n)
			if bufbyte <>0 then 
				sp$ = sp$ + Chr(bufbyte)
			else
				exit 
			endif
		Next
	EndIf
	return (trim(sp$) + "")
End Function