genericunixprotocols/telnetsrv/src/install.cpp
changeset 0 c6b0df440bee
equal deleted inserted replaced
-1:000000000000 0:c6b0df440bee
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 #include <stdlib.h>
       
    19 #include <stdio.h>
       
    20 #include <string.h>
       
    21 #include <e32base.h>
       
    22 #include <utf.h>
       
    23 #include <swi/launcher.h>
       
    24 #include <unistd.h>
       
    25 #include "uihandler.h"
       
    26 
       
    27 int main(int argc, char *argv[], char **/*envp*/)
       
    28 	{
       
    29 	
       
    30 	TInt err = KErrNone;
       
    31 	
       
    32 	if(argc!=2)
       
    33 		{
       
    34 		printf("Usage:\n");
       
    35 		printf("test_install [SIS file absolute path]\n");
       
    36 		printf("Example:\n");
       
    37 		printf("test_install c:\\package.sis\n");
       
    38 		exit(KErrNone);
       
    39 		}
       
    40 	
       
    41 	TBuf16<KMaxFileName> desc;
       
    42 	
       
    43 	TPtrC8 src((const TUint8*)argv[1]);
       
    44 	
       
    45 	CnvUtfConverter::ConvertToUnicodeFromUtf8(desc, src);
       
    46 	
       
    47 	TFileName fileName(desc);
       
    48 	
       
    49 	fileName.PtrZ();
       
    50 	
       
    51 	Swi::CInstallPrefs* installPrefs = Swi::CInstallPrefs::NewL();
       
    52 	CUIHandler* uiHandler = CUIHandler::NewL();
       
    53 	
       
    54 	err = Swi::Launcher::Install(*uiHandler,fileName,*installPrefs);
       
    55 
       
    56 	delete uiHandler;
       
    57 	delete installPrefs;
       
    58 	
       
    59 	printf("Return Code: %d\n",err);
       
    60 	
       
    61 	exit(err);
       
    62 	}
       
    63