Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / how can i find abs path for different users ?

Author
Message
evan
23
Years of Service
User Offline
Joined: 11th Jun 2003
Location: United Kingdom
Posted: 25th Aug 2003 14:19
Making a card game which also plays any music in
the "C:\Documents and Settings\evan\My Documents\My Music"
folder.
Everything ok no my comp as i know my user name (evan)
and know the absolute path to My Music,but will not
work on other peoples comps.
Is there any way u can get the users name from windows,or another way to get to My Music without using a user name
thanks

p.s i'm using windows xp.
OSX Using Happy Dude
22
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 25th Aug 2003 14:46
It looks like you'll have to go through the registry to find it unfortunately.

You can also get the name of the user currently logged on...


Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 25th Aug 2003 15:28 Edited at: 25th Aug 2003 15:28
When it comes to mp3 collections I think many of us file and organise our mp3's elsewhere on our computer. Personally I am just starting to rebuild my mp3 collection after a drive failure took out my last one, but to give you an idea that was a 10gb collection built up over a long time that had it's own hard disk F: with category and artist directories (with quite a lot of errors )

Perhaps a directory selection dialogue would work better?

Pneumatic Dryll
evan
23
Years of Service
User Offline
Joined: 11th Jun 2003
Location: United Kingdom
Posted: 25th Aug 2003 18:44
Found one way to do it.but won't work all the time :-


set dir "C:\Documents and Settings\"
find first
do
a$=get file name$()
if a$<>"." and a$<>".." and a$<>"Default User" and a$<>"All Users" and a$<>"NetworkService" and a$<>"LocalService" then exit
find next
loop

b$="C:\Documents and Settings\"+a$+"\My Documents\My Music"
print b$
wait key
Andy Igoe
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United Kingdom
Posted: 25th Aug 2003 21:43 Edited at: 25th Aug 2003 21:44
Alas it will still fail for the majority of users. Primarily because the majority of users are not configured for multi-user login thus it would fail even for those who do put music into their "My Music" directory.

If I recall correctly the appropriate command to read in the My Music folder from the registry would be:



Although i'm not sure exactly how DBPro determines which HKEY it is reading, maybe IanM or one of the other clever people can answer that. We need to specify "HKEY_CURRENT_USER".

I recommend against using the My Music folder if the program is for general release for the reasons already given.

Pneumatic Dryll

Login to post a reply

Server time is: 2026-07-23 00:17:24
Your offset time is: 2026-07-23 00:17:24