genericopenlibs/openenvcore/libc/src/wremove.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 2005-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 "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 // Name        : wremove.cpp
       
    15 // Part of     : LIBC
       
    16 // Contains the source for wremove
       
    17 // Version     : 1.0
       
    18 //
       
    19 
       
    20 
       
    21 
       
    22 #include <wchar.h>
       
    23 #include<e32const.h>
       
    24 #include <errno.h>
       
    25 
       
    26 extern "C"
       
    27 {
       
    28 
       
    29 EXPORT_C int
       
    30 wremove(const wchar_t *file)	
       
    31 	{
       
    32 	struct stat sb;
       
    33 	if(file)
       
    34 	{
       
    35 	if (wstat(file, &sb) < 0)
       
    36 		return (-1);
       
    37 	if (S_ISDIR(sb.st_mode))
       
    38 		return (wrmdir(file));
       
    39 	return (wunlink(file));
       
    40 	}
       
    41 	errno = EFAULT;
       
    42 	return -1;
       
    43 	}
       
    44 	
       
    45 }//extern "C"
       
    46 
       
    47 
       
    48