imgtools/romtools/rofsbuild/r_driveimage.cpp
author y4jin
Thu, 18 Nov 2010 13:43:06 +0800
changeset 704 0f8b90f18a21
parent 617 3a747a240983
permissions -rw-r--r--
Fix the illegal word scanned by sfchecksource tools
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     1
/*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     2
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     3
* All rights reserved.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     4
* This component and the accompanying materials are made available
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     6
* which accompanies this distribution, and is available
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     8
*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     9
* Initial Contributors:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    10
* Nokia Corporation - initial contribution.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    11
*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    12
* Contributors:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    13
*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    14
* Description: 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    15
* @internalComponent * @released
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    16
* Driveimage class implementation.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    17
*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    18
*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    19
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    20
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    21
#include <stdlib.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    22
#include <string>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    23
#include "fsnode.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    24
#include "fatimagegenerator.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    25
#include <boost/filesystem.hpp>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    26
#include <stack>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    27
#include <utility>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    28
#include <new>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    29
using namespace boost ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    30
#ifdef __LINUX__
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    31
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    32
	#include <dirent.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    33
	#ifndef MKDIR
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    34
		#define MKDIR(a)	mkdir(a,0777)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    35
	#endif
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    36
#else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    37
	#ifdef _STLP_INTERNAL_WINDOWS_H
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    38
	#define __INTERLOCKED_DECLARED
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    39
	#endif
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    40
	#include <windows.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    41
	#include <direct.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    42
	#ifndef MKDIR
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    43
		#define MKDIR		mkdir
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    44
	#endif
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    45
#endif
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    46
#include <sys/stat.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    47
#include <sys/types.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    48
using namespace std;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    49
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    50
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    51
#include <f32file.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    52
#include "h_utl.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    53
#include "r_obey.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    54
#include "r_romnode.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    55
#include "r_rofs.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    56
#include "r_driveimage.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    57
 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    58
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    59
Constructor: CDriveImage class 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    60
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    61
@param aObey - pointer to Drive obey file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    62
*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    63
CDriveImage::CDriveImage(CObeyFile *aObey)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    64
	: iObey( aObey )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    65
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    66
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    67
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    68
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    69
CDriveImage::~CDriveImage()
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    70
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    71
 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    72
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    73
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    74
	* 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    75
  */
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    76
TFSNode* CDriveImage::PrepareFileSystem(TRomNode* aRomNode){ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    77
	TUint8 attrib ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    78
	TFSNode* root = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    79
	TRomNode* romNode = aRomNode;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    80
	stack<pair<TRomNode*,TFSNode*> > nodesStack ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    81
	TFSNode* parentFS = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    82
	TFSNode* curFS = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    83
	bool err = false ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    84
    while(1) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    85
        attrib = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    86
        if(romNode->iAtt & KEntryAttReadOnly)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    87
			attrib |= ATTR_READ_ONLY ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    88
		if(romNode->iAtt & KEntryAttHidden)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    89
			attrib |= ATTR_HIDDEN ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    90
		if(romNode->iAtt & KEntryAttSystem)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    91
			attrib |= ATTR_SYSTEM ;  
617
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
    92
		if(romNode->IsDirectory()) {
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
    93
			try {
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
    94
				curFS = new TFSNode(parentFS,romNode->iName,attrib | ATTR_DIRECTORY);
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
    95
			}
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
    96
			catch(const char* errInfo){
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
    97
				Print(EError,errInfo);
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
    98
				err = true ;
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
    99
				break ;
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   100
			}
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   101
			catch(...) {
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   102
				err = true ;
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   103
				break ;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   104
			} 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   105
			if(!root) root = curFS ;  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   106
			time_t now = time(NULL); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   107
			curFS->Init(now,now,now,0); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   108
			TRomNode* child = romNode->Currentchild();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   109
			if(child){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   110
				TRomNode* sibling = romNode->Currentsibling(); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   111
				if(sibling)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   112
					nodesStack.push(make_pair(sibling,parentFS));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   113
				romNode = child ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   114
				parentFS = curFS ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   115
				continue ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   116
			}			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   117
		}
617
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   118
		else { // file   
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   119
			try {         
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   120
				curFS = new TFSNode(parentFS,romNode->iEntry->iName,attrib,romNode->iEntry->iFileName);
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   121
			}
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   122
			catch(const char* errInfo){
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   123
				Print(EError,errInfo);
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   124
				err = true ;
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   125
				break ;
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   126
			}
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   127
			catch(...) { 
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   128
					err = true ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   129
					break ;
617
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   130
			} 
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   131
					
617
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   132
			if(!root) root = curFS ;  
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   133
			struct stat statbuf ;
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   134
			stat(romNode->iEntry->iFileName, &statbuf);             
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
   135
			curFS->Init(statbuf.st_ctime,statbuf.st_atime,statbuf.st_mtime,statbuf.st_size);   
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   136
		 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   137
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   138
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   139
		TRomNode* sibling = romNode->Currentsibling(); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   140
		if(sibling) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   141
			romNode = sibling ; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   142
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   143
		else { 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   144
			if(nodesStack.empty()) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   145
				break ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   146
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   147
			else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   148
				romNode = nodesStack.top().first;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   149
				parentFS = nodesStack.top().second ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   150
				nodesStack.pop() ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   151
				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   152
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   153
		}		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   154
    }
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   155
	if(err) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   156
		if(root) delete root ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   157
		return NULL ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   158
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   159
    return root ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   160
} 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   161
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   162
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   163
Creates the Image/Call to file system module.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   164
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   165
Updates the required operations to generate the data drive images.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   166
Deletes the temp folder if created.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   167
Calls the file system modules with required parameters.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   168
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   169
@param alogfile - Logfile name required for file system module.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   170
@return Status(r) - returns the status of file system module.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   171
                   'KErrGeneral' - Unable to done the above operations properly.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   172
*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   173
TInt CDriveImage::CreateImage(const char* alogfile) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   174
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   175
	TSupportedFatType fst = EFatUnknown ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   176
	if(stricmp(iObey->iDriveFileFormat,"FAT16") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   177
	    fst = EFat16 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   178
	else if(stricmp(iObey->iDriveFileFormat,"FAT32") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   179
	        fst = EFat32 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   180
	if(EFatUnknown == fst){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   181
        Print(EError,"Unsupported FAT type : %s",iObey->iDriveFileFormat);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   182
        return KErrGeneral ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   183
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   184
	 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   185
	TFatImgGenerator generator(fst,iObey->iConfigurableFatAttributes);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   186
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   187
	if(!generator.IsValid()){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   188
	    return KErrGeneral; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   189
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   190
	TFSNode* root = PrepareFileSystem(iObey->iRootDirectory);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   191
	if(!root)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   192
	    return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   193
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   194
 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   195
	TInt retVal = generator.Execute(root,iObey->iDriveFileName) ? KErrNone : KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   196
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   197
	delete root ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   198
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   199
	return 	retVal;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   200
}