00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <f32file.h>
00018 #include "CommonFramework.h"
00019
00020 static RFs fsSession;
00021
00022
00023 void CreatePathsL();
00024 void ParseNamesL(const TDesC& aFullName);
00025
00026 void WaitForKey()
00027 {
00028 _LIT(KMessage,"Press any key to continue\n\n");
00029 console->Printf(KMessage);
00030 console->Getch();
00031 }
00032
00033 static void doExampleL()
00034 {
00035
00036 User::LeaveIfError(fsSession.Connect());
00037 CreatePathsL();
00038 fsSession.Close();
00039 }
00040
00041 void CreatePathsL()
00042 {
00043
00044 _LIT(KFuncName,"\nDoParsing()\n");
00045 _LIT(KParse1,"d:\\path\\fn.ext");
00046 _LIT(KParse2,"autoexec.bat");
00047 _LIT(KParse3,"\\readme");
00048 _LIT(KParse4,"\\include\\stdio.h");
00049 _LIT(KParse5,".profile");
00050 _LIT(KParse6,"autoexec.*");
00051 console->Printf(KFuncName);
00052
00053
00054
00055 ParseNamesL(KParse1);
00056 WaitForKey();
00057 ParseNamesL(KParse2);
00058 WaitForKey();
00059 ParseNamesL(KParse3);
00060 WaitForKey();
00061 ParseNamesL(KParse4);
00062 WaitForKey();
00063 ParseNamesL(KParse5);
00064 WaitForKey();
00065 ParseNamesL(KParse6);
00066 WaitForKey();
00067 }
00068
00069 void ParseNamesL(const TDesC& aFullName)
00070 {
00071 _LIT(KFullName,"Full name=%S\n");
00072 _LIT(KPathComponents,"Drive=%S path=%S name=%S ext=%S\n");
00073 _LIT(KFullNameText,"Full name against session path=%S\n");
00074 _LIT(KExtension,".txt");
00075 _LIT(KParsedPath,"Full name against session path and default extension=%S\n");
00076
00077
00078
00079
00080
00081 TParse p;
00082
00083 User::LeaveIfError(p.Set(aFullName,NULL,NULL));
00084 console->Printf(KFullName, &p.FullName());
00085 TFileName drivename(p.Drive());
00086 TFileName pathname(p.Path());
00087 TFileName filename(p.Name());
00088 TFileName extension(p.Ext());
00089 console->Printf(KPathComponents,&drivename,&pathname,&filename,&extension);
00090
00091 User::LeaveIfError(fsSession.Parse(aFullName,p));
00092 console->Printf(KFullNameText,&(p.FullName()));
00093
00094 User::LeaveIfError(fsSession.Parse(aFullName,KExtension,p));
00095 console->Printf(KParsedPath,&(p.FullName()));
00096 }
00097
00098
00099
00100