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