My new laptop, Win 10 now names the user folder with the first 5 letters of the email address so it does not match the user name and the program crashes.
B4X:
Dim username As String = GetSystemProperty("user.name", "default")
Log(username)
fc.Initialize
fc.InitialDirectory ="C:\Users\" &username &"\Desktop" ' Set starting folder
so is it possible to look up the user folder name, rather than the user name..
thanks
Yes it worked fine on my old laptop,because the user (account) name matches the user folder name,
If you get a new computer Windows changed it so now the user name is not used for the user folder name , it uses the first five letter of your email address so the code fails.
To make the code work I need to find the user folder name not the user name.
Thanks
Thaks Erel,
I wanted to start the browse on the desktop to assist the user..
After the user.name didn't match the named folder C:/user/username its stopped working.
I fixed it by creating a new user.
Thanks
Just a quick thought to throw a spanner in the machine.
Windows doesn't maintain the link between the user's chosen username - as displayed when the log on - and the name of the folder.
When you first create a Local account, the folder name will probably be the same as the username. If the user subsequently changes their username, then the folder will not change and they won't match.
If you start from a Microsoft account login, then this will be something similar to what you describe - part of the account name (email address) will be used to create the folder name and this also will then never change.
If you want to access the Desktop of the current user then you'll need to start from the %HOMEPATH% system variable in windows.
Thanks David, that's what i want to do, so if a user changes an account name the program won't be affected.
I will use that solution in the distributed version.
Graham