|
Post by mknarr on Dec 22, 2020 10:56:04 GMT -5
I was recently using a program I wrote that saved things in "My Documents" Folder in Windows 10. After saving the data, I went to find it and it was no where to be seen in my document folder but was in my OneDrive folder. I don't want OneDrive and have since disabled it but that doesn't solve the problem. I have been using the code:
AppFolder$=GetSpecialfolder$(5)
Function GetSpecialfolder$(CSIDL) struct IDL,cb As uLong,abID As short calldll #shell32, "SHGetSpecialFolderLocation",_ 0 as ulong, _ CSIDL as ulong, _ IDL as struct,_ ret as ulong if ret=0 then path$ = Space$(_MAX_PATH) id = IDL.cb.struct calldll #shell32, "SHGetPathFromIDListA",_ id as ulong, _ path$ as ptr, _ ret as ulong GetSpecialfolder$ = trim$(path$)
if instr(GetSpecialfolder$,"\OneDrive")>0 then GetSpecialfolder$=replstr$(GetSpecialfolder$,"\OneDrive","") 'This line added
end if end function
It is a simple fix to add the line to remove \OneDrive but now I have to find other programs I save data in the Documents folder. Just a heads up especially if you have programs out there like I do that might be saving data where you don't want it.
|
|
|
Post by Chris Iverson on Dec 22, 2020 12:36:16 GMT -5
You're better off modifying the Documents folder location instead of trying to fix that in every program you come across, especially since most of them won't let you fix it, and you'll be stuck navigating manually.
If the SHGetSpecialFolderLocation() function is still returning the path of the folder in OneDrive as your Documents folder, then there's a way to get it to instead point to the original Documents folder(or wherever else you want it to; I've got my libraries pointing to a different drive.)
Open up File Explorer, and navigate to the Documents folder currently returned by the SHGetSpecialFolderLocation() function. Go back up one folder so you can see the Documents folder as an item. Right-click on it and select "Properties".
If this is the right folder, and it's currently recognized as your Documents library, you should see a tab on the Properties page, "Location". This lets you move/change the folder where your "Documents" get stored in by default - that is, it lets you change the path returned by SHGetSpecialFolderLocation().
|
|