0
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// e32test\lffs\load9660.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include <f32file.h>
|
|
19 |
|
|
20 |
_LIT(KFileSystemDllName, "iso9660.fsy");
|
|
21 |
_LIT(KFileSystemName, "iso9660");
|
|
22 |
|
|
23 |
RFs TheFs;
|
|
24 |
|
|
25 |
TInt MountISO9660()
|
|
26 |
{
|
|
27 |
TBuf<256> cmd;
|
|
28 |
User::CommandLine(cmd);
|
|
29 |
TLex cmdlex(cmd);
|
|
30 |
cmdlex.SkipSpace();
|
|
31 |
TUint c = (TUint)cmdlex.Get();
|
|
32 |
if (c>='a' && c<='z')
|
|
33 |
c-=0x20;
|
|
34 |
if (c<'A' || c>'Z')
|
|
35 |
return KErrArgument;
|
|
36 |
TBuf<4> driveLetter;
|
|
37 |
driveLetter.SetLength(1);
|
|
38 |
driveLetter[0] = (TText)c;
|
|
39 |
RDebug::Print(_L("Drive %S"), &driveLetter);
|
|
40 |
|
|
41 |
TInt driveNumber = TInt(c-'A') + TInt(EDriveA);
|
|
42 |
TInt r;
|
|
43 |
driveLetter.Append(_L(":\\"));
|
|
44 |
|
|
45 |
RDebug::Print(_L("Add file system: %S"), &KFileSystemDllName);
|
|
46 |
r=TheFs.AddFileSystem(KFileSystemDllName);
|
|
47 |
if (r!=KErrNone && r!=KErrAlreadyExists)
|
|
48 |
{
|
|
49 |
RDebug::Print(_L("Failed: %d"), r);
|
|
50 |
return r;
|
|
51 |
}
|
|
52 |
|
|
53 |
TFullName name;
|
|
54 |
r = TheFs.FileSystemName(name, driveNumber);
|
|
55 |
if (name.Length() != 0)
|
|
56 |
{
|
|
57 |
RDebug::Print(_L("Dismounting %S on drive %S\r\n"), &name, &driveLetter);
|
|
58 |
r=TheFs.DismountFileSystem(name, driveNumber);
|
|
59 |
RDebug::Print(_L("Dismount ret=%d"), r);
|
|
60 |
}
|
|
61 |
|
|
62 |
RDebug::Print(_L("Mount ISO9660 on drive %S\r\n"), &driveLetter);
|
|
63 |
r = TheFs.MountFileSystem(KFileSystemName, driveNumber);
|
|
64 |
RDebug::Print(_L("Mount r=%d"),r);
|
|
65 |
return KErrNone;
|
|
66 |
}
|
|
67 |
|
|
68 |
GLDEF_C TInt E32Main()
|
|
69 |
{
|
|
70 |
|
|
71 |
CTrapCleanup* cleanup;
|
|
72 |
cleanup=CTrapCleanup::New();
|
|
73 |
|
|
74 |
TInt r=TheFs.Connect();
|
|
75 |
RDebug::Print(_L("Connect ret %d"),r);
|
|
76 |
|
|
77 |
if (r == KErrNone)
|
|
78 |
r = MountISO9660();
|
|
79 |
RDebug::Print(_L("Mount ISO9660 ret %d"),r);
|
|
80 |
|
|
81 |
TheFs.Close();
|
|
82 |
delete cleanup;
|
|
83 |
return KErrNone;
|
|
84 |
}
|
|
85 |
|