/****************************** Module Header ******************************* * * Module Name: deletetree.e * * E wrapper routine to access the NEPMD library DLL. * Include of nepmdlib.e. * * Copyright (c) Netlabs EPM Distribution Project 2002 * * $Id$ * * =========================================================================== * * This file is part of the Netlabs EPM Distribution package and is free * software. You can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * Netlabs EPM Distribution. This library is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * ****************************************************************************/ /* @@NepmdDeleteTree@PROTOTYPE NepmdDeleteTree( Dirname) @@NepmdDeleteTree@CATEGORY@FILE @@NepmdDeleteTree@SYNTAX This function deletes a directory, all contained subdirectories and all contained files. @@NepmdDeleteTree@PARM@Dirname This parameter specifies the name of the directory to be deleted. @@NepmdDeleteTree@RETURNS *NepmdDeleteTree* returns nothing. This procedure sets the implicit universal var *rc*. rc is set to an [inf:cp2 "Errors" OS/2 error code] or to zero for no error. @@NepmdDeleteTree@REMARKS *NepmdDeleteTree* removes all file attributes, if required. Locked file objects were tried to unlock before deletion. @@NepmdDeleteTree@TESTCASE You can test this function from the *EPM* commandline by executing: .sl - *NepmdDeleteTree* [.IDPNL_EFUNC_NEPMDDELETETREE_PARM_DIRNAME dirname] - or - *DeleteTree* [.IDPNL_EFUNC_NEPMDDELETETREE_PARM_DIRNAME dirname] Executing this command will delete the specified tree and display the result within the status area. *Example:* .fo text DeleteTree d:\tmp\mydir .fo on @@ */ ; --------------------------------------------------------------------------- ; Allow editor command to call function ; --------------------------------------------------------------------------- compile if NEPMD_LIB_TEST defc NepmdDeleteTree, DeleteTree do i = 1 to 1 Dirname = arg( 1) if (Dirname = '') then sayerror 'Error: no dirname specified.' leave endif call NepmdDeleteTree( Dirname) if (rc = 0) then StrResult = 'been deleted' else StrResult = 'not been deleted, rc = 'rc'.' endif sayerror 'Tree "'Dirname'" has' StrResult enddo compile endif ; --------------------------------------------------------------------------- ; Procedure: NepmdDeleteTree ; --------------------------------------------------------------------------- ; E syntax: ; NepmdDeleteTree( dirname) ; --------------------------------------------------------------------------- ; C prototype: ; APIRET EXPENTRY NepmdDeleteTree( PSZ pszDirname); ; --------------------------------------------------------------------------- defproc NepmdDeleteTree( Dirname) -- Prepare parameters for C routine Dirname = Dirname\0 -- Call C routine LibFile = helperNepmdGetlibfile() rc = dynalink32( LibFile, "NepmdDeleteTree", address( Dirname)) helperNepmdCheckliberror( LibFile, rc) return