Playlist: fix scrolling events in selector
[vlc/vlc-skelet.git] / src / symbian / path.cpp
blob0a54d1a075bb5e960222a087582b6450e81c03a6
1 /*****************************************************************************
2 * path.cpp : Symbian Application's Provate Path
3 *****************************************************************************
4 * Copyright © 2010 Pankaj Yadav
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
21 #include <f32file.h> /* RFs */
22 #include <string.h> /* strlen */
23 #include <utf.h> /* CnvUtfConverter */
25 extern "C" {
26 #include "path.h"
29 /*Way to Find AppPrivatePath (A Path where an application can store its private data) */
30 static TInt GetPrivatePath(TFileName& privatePath)
32 TFileName KPath;
33 RFs fsSession;
34 TInt result;
36 result = fsSession.Connect();
37 if (result != KErrNone)
39 return result;
41 fsSession.PrivatePath(KPath);
42 TFindFile findFile(fsSession);
44 privatePath = KPath;
45 result = findFile.FindByDir(KPath, KNullDesC);
46 if (result == KErrNone)
48 privatePath = findFile.File();
51 fsSession.Close();
52 return result;
55 extern "C" char * GetConstPrivatePath(void)
57 TFileName privatePath;
58 TBuf8<KMaxFileName> privatepathutf8;
59 size_t len;
60 char carray[KMaxFileName];
62 if (GetPrivatePath(privatePath) != KErrNone)
64 return strdup("C:\\Data\\Others");
67 CnvUtfConverter::ConvertFromUnicodeToUtf8( privatepathutf8, privatePath );
69 TInt index = 0;
70 for (index = 0; index < privatepathutf8.Length(); index++)
72 carray[index] = privatepathutf8[index];
74 carray[index] = 0;
76 if ((len = strnlen((const char *)carray, KMaxFileName) < KMaxFileName))
78 carray[len-1] = '\0';
79 return strdup((const char *)carray);
81 else
83 return strdup("C:\\Data\\Others");