|
|
Classification: |
C++ |
Category: |
EIKON |
Created: |
06/11/2002 |
Modified: |
07/23/2003 |
Number: |
FAQ-0800 |
Platform: |
ER5, Symbian OS v6.0 |
|
Question: I'd like to find out the default document folder on the device, how can I do this?
Answer: This is generally possible - but not via any set of supported or documented APIs. This means it cannot be guaranteed to work
and may change between different devices and/or different Symbian OS releases. However, the following code has been used successfully: Nokia 9200 Communicator Series // Constant for obtaining default document folder const TUid KUidGlobalDefaultDocumentDirectory = {0x10005127}; // #include // for CDictionaryFileStore ... { TFileName defaultFolder; CDictionaryStore* store=CDictionaryFileStore::SystemLC(iEikonEnv->FsSession()); if (store->IsPresentL(KUidGlobalDefaultDocumentDirectory)) { RDictionaryReadStream stream; stream.OpenLC(*store,KUidGlobalDefaultDocumentDirectory); stream >> defaultFolder; CleanupStack::PopAndDestroy(); //stream }elsedefaultFolder.Zero();CleanupStack::PopAndDestroy(); //store } Symbian OS v5 (and earlier) _LIT(KShellIniFile,"c:\\System\\Apps\\Shell\\Shell.ini"); const TUid KUidShellApp = {0x10000076}; const TUid KUidShellPreferences = {0x10000296}; // Old, not used in ER5 const TUid KUidShlPreferencesER5 = {0x10003EE0}; // New, for ER5 ... { CDictionaryStore* shellIni=CDictionaryFileStore::OpenLC(iEikonEnv->FsSession(),KShellIniFile,KUidShellApp); RDictionaryReadStream stream; stream.OpenLC(*shellIni,KUidShellPreferences); TInt32 statusFlags; TFileName aDefaultDir; TRAPD(err,stream >> statusFlags); if (err==KErrEof) { // KUidShellPreferences not found CleanupStack::PopAndDestroy(); //stream stream.OpenLC(*shellIni, KUidShlPreferencesER5); TRAP(err,stream >> statusFlags); if (err==KErrEof) // KUidShellPreferencesER5 not found either User::Leave(KErrNotSupported); else User::Leave(err); } else User::Leave(err); stream >> aDefaultDir; CleanupStack::PopAndDestroy(); // stream CleanupStack::PopAndDestroy(); // shellIni }
|
|
|