Page 1 of 1
Where to save media files?
Posted: Thu Nov 11, 2010 7:12 pm
by davedev
I am building a player application that will play activities based on activity files that the user installs to their system. The activity files will be large and a user can accumulate many of them. Where would be the appropriate place to store these files on Windows?
Another requirement is that the activities are available to all user's of the player. On the Mac, I am placing them in the user's Shared directory.
What would be the a good place to store them on Windows XP, Vista, and Windows 7?
Re: Where to save media files?
Posted: Thu Nov 11, 2010 8:03 pm
by idle
probably best to store them in the users application data folder
[edit]
I just did an enumeration and added missing CSIDL
though I don't have all of them present on my system
GetSpecialFolderLocation(#CSIDL_APPDATA)
Code: Select all
#CSIDL_DESKTOP = $0 ;\Desktop
#CSIDL_INTERNET = $1 ;Internet Explorer (icon on desktop)
#CSIDL_PROGRAMS = $2 ;\Start Menu\Programs\
#CSIDL_DOCUMENTS = $5 ;\My Documents\
#CSIDL_FAVORITES = $6 ;\FAVORITES\
#CSIDL_STARTUP = $7 ;\Start Menu\Programs\Startup\
#CSIDL_RECENT = $8 ;\RECENT\
#CSIDL_SENDTO = $9 ;\SENDTO\
#CSIDL_BITBUCKET = $A ;{desktop}\Recycle Bin
#CSIDL_STARTMENU =$B ;\Start Menu\
#CSIDL_MYMUSIC = $D ;\My Documents\My Music\
#CSIDL_DESKTOPDIRECTORY = $10 ;{users}\DESKTOP\
#CSIDL_DRIVES = $11 ;My Computer
#CSIDL_NETWORK = $12 ;Network Neighbourhood
#CSIDL_NETHOOD = $13 ;{user}\nethood
#CSIDL_FONTS = $14 ;windows\fonts
#CSIDL_TEMPLATES = $15
#CSIDL_COMMON_STARTMENU = $16 ;All Users\Start Menu
#CSIDL_COMMON_PROGRAMS = $17 ;All Users\Programs
#CSIDL_COMMON_STARTUP = $18 ;All Users\Startup
#CSIDL_COMMON_DESKTOPDIRECTORY = $19;All Users\Desktop
#CSIDL_APPDATA = $1A ;{user}\Application Data
#CSIDL_PRINTHOOD = $1B ;{user}\PrintHood
#CSIDL_LOCAL_APPDATA = $1C ;{user}\Local Settings\Application Data (non roaming)
#CSIDL_ALTSTARTUP = $1D ;non localized startup
#CSIDL_COMMON_ALTSTARTUP = $1E ;non localized common startup
#CSIDL_COMMON_FAVORITES = $1F
#CSIDL_INTERNET_CACHE = $20 ;\Local Settings\Temporary Internet Files\
#CSIDL_COOKIES = $21
#CSIDL_HISTORY = $22
#CSIDL_COMMON_APPDATA = $23 ;All Users\Application Data
#CSIDL_WINDOWS = $24 ;GetWindowsDirectory()
#CSIDL_SYSTEM = $25 ;GetSystemDirectory()
#CSIDL_PROGRAM_FILES = $26 ;C:\Program Files
#CSIDL_MYPICTURES = $27 ;C:\Program Files\My Pictures
#CSIDL_PROFILE = $28 ;USERPROFILE
#CSIDL_SYSTEMX86 = $29
#CSIDL_PROGRAM_FILESX86 = $2A ;x86 C:\Program Files on RISC
#CSIDL_PROGRAM_FILES_COMMON = $2B ;C:\Program Files\Common
#CSIDL_PROGRAM_FILES_COMMONX86 = $2C ;x86 Program Files\Common on RISC
#CSIDL_COMMON_TEMPLATES = $2D ;All Users\Templates
#CSIDL_COMMON_DOCUMENTS = $2E ;All Users\Documents
#CSIDL_COMMON_ADMINTOOLS = $2F ;All Users\Start Menu\Programs\Administrative Tools
#CSIDL_ADMINTOOLS = $30 ;\Start Menu\Programs\Administrative Tools\
#CSIDL_COMMON_MUSIC = $35 ;\All Users\Documents\My Music\
#CSIDL_COMMON_PICTURES = $36 ;\All Users\Documents\My Pictures\
#CSIDL_COMMON_VIDEOS = $37 ;\All Users\Documents\My Videos\
#CSIDL_RESOURCES = $38 ;\WINDOWS\Resources\
#CSIDL_CDBURN_AREA = $3B ;\Local Settings\Application Data\Microsoft\CD Burning\
#CSIDL_FLAG_CREATE = $8000 ;combine with CSIDL_ value to force
;create on SHGetSpecialFolderLocation()
#CSIDL_FLAG_DONT_VERIFY = $4000 ;combine with CSIDL_ value to force
;create on SHGetSpecialFolderLocation()
#CSIDL_FLAG_MASK = $FF00 ;mask for all possible flag values
#SHGFP_TYPE_CURRENT = $0 ;current value for user, verify it exists
#SHGFP_TYPE_DEFAULT = $1
Procedure.s GetSpecialFolderLocation(Value.l)
Protected Folder_ID,SpecialFolderLocation.s
If SHGetSpecialFolderLocation_(0, Value, @Folder_ID) = 0
SpecialFolderLocation = Space(#MAX_PATH*2)
SHGetPathFromIDList_(Folder_ID, @SpecialFolderLocation)
If SpecialFolderLocation
If Right(SpecialFolderLocation, 1) <> "\"
SpecialFolderLocation + "\"
EndIf
EndIf
CoTaskMemFree_(Folder_ID)
EndIf
ProcedureReturn SpecialFolderLocation.s
EndProcedure
;dump paths
For a = 0 To 254
spd.s = GetSpecialFolderLocation(a)
If spd <> ""
Debug spd + " " + Str(a) + " " + Hex(a)
EndIf
Next
Re: Where to save media files?
Posted: Thu Nov 11, 2010 10:39 pm
by tinman
If it needs to be accessed by all users you'd be better off using one of the "_COMMON_" folders, such as #CSIDL_COMMON_DOCUMENTS.
Personally I'd put it in #CSIDL_COMMON_DOCUMENTS (or a sub-directory) if the user has created the files (either by purchase or whatever else). Put it in APPDATA if your application has created it.
I'm not sure whether there's a definition or a "standard" for getting paths to directories such "My Music" which resides in "My Documents" at least in my XP.
Edit: CSIDL_COMMON_MUSIC was added for XP to give you access to that directory.
#CSIDL_COMMON_MUSIC = $35