secureswitools/swisistools/source/sisxlibrary/utility_linux.cpp
branchRCL_3
changeset 25 7333d7932ef7
parent 24 5cc91383ab1e
child 26 8b7f4e561641
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
   625 		}
   625 		}
   626 	return retValue;
   626 	return retValue;
   627 	}
   627 	}
   628 
   628 
   629 
   629 
   630 int FileCopyA(const char* aSrc, const char* aDest, size_t aFlag)
   630 int FileCopyA(const char* aSrc, const char* aDest, bool aFailIfExistsFlag)
   631 	{
   631 	{
   632 		int err= 0;
   632 		int err= 0;
   633 		const int len = 512;
   633 
   634 		// Overwrites the orphaned file(if any).
   634 		char cmd[ commandLength ] = "";
   635 		char cmd[ len ] = "cp -f ";
   635 		if( aFailIfExistsFlag )
       
   636 		{
       
   637 			strcpy(cmd, "cp ");
       
   638 		}
       
   639 		else
       
   640 		{
       
   641 			strcpy(cmd, "cp -f ");
       
   642 		}
   636 		strcat(cmd, aSrc);
   643 		strcat(cmd, aSrc);
   637 		strcat(cmd, " ");
   644 		strcat(cmd, " ");
   638 		strcat(cmd, aDest);
   645 		strcat(cmd, aDest);
   639 		strcat(cmd, " 2> /dev/null");
   646 		strcat(cmd, " 2> /dev/null");
   640 
   647 
   641         err = system(cmd);
   648         err = system(cmd);
   642 
   649 
   643 		return err;
   650 		return err;
   644 	}
   651 	}
   645 	
       
   646 int FileMoveA(const char* aSrc, const char* aDest)
   652 int FileMoveA(const char* aSrc, const char* aDest)
   647 	{
   653 	{
   648 		int err= 0;
   654 		int err= 0;
   649 
   655 
   650 		// Overwrites the orphaned file(if any).
   656 		// Overwrites the orphaned file(if any).
   651 		char cmd[ 512 ] = "mv -f ";
   657 		char cmd[ commandLength ] = "mv -f ";
   652 		strcat(cmd, aSrc);
   658 		strcat(cmd, aSrc);
   653 		strcat(cmd, " ");
   659 		strcat(cmd, " ");
   654 		strcat(cmd, aDest);
   660 		strcat(cmd, aDest);
   655 		strcat(cmd, " 2> /dev/null");
   661 		strcat(cmd, " 2> /dev/null");
   656 
   662