$IFNDEF __FILEOPS_INC
$DEFINE __FILEOPS_INC
FUNCTION Quote(StringToQuote AS STRING) AS STRING
StringToQuote = CHR$(34) + StringToQuote + CHR$(34)
Result = REPLACESUBSTR$(stringtoquote , CHR$(34) + CHR$(34) , CHR$(34))
END FUNCTION
FUNCTION StripPath(fullname AS STRING) AS STRING
Result = LEFT$(fullname , rinstr(fullname , "\"))
END FUNCTION
FUNCTION StripFileName(fullname AS STRING) AS STRING
Result = RIGHT$(fullname , LEN(fullname) - rinstr(fullname , "\"))
END FUNCTION
FUNCTION StripFileExt(fullname AS STRING) AS STRING
Result = RIGHT$(fullname , LEN(fullname) - rinstr(fullname , ".") + 1)
END FUNCTION
FUNCTION FileNameNoExt(fullname AS STRING) AS STRING
fullname = RIGHT$(fullname , LEN(fullname) - rinstr(fullname , "\"))
Result = LEFT$(fullname , rinstr(fullname , ".") - 1)
END FUNCTION
FUNCTION FullPathNoExt(fullname AS STRING) AS STRING
Result = LEFT$(fullname , rinstr(fullname , ".") - 1)
END FUNCTION
FUNCTION C_Style(fullname AS STRING) AS STRING
fullname = REPLACESUBSTR$(fullname , "\\" , "\")
Result = REPLACESUBSTR$(fullname , "\" , "/")
END FUNCTION
FUNCTION SysDir(dir AS STRING) AS STRING
DIM fo_reg AS QREGISTRY
fo_reg.RootKey = &H80000001
fo_reg.openkey("Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" , 0)
Result = fo_reg.readstring(dir) + "\"
END FUNCTION
SUB FileCopy(FileSrc$ AS STRING, FileDst$ AS STRING)
DIM FileSrc AS QFILESTREAM
DIM FileDst AS QFILESTREAM
FileSrc.OPEN(FileSrc$ , fmOpenRead)
FileDst.OPEN(FileDst$ , fmCreate)
FileDst.CopyFrom(FileSrc , 0)
FileSrc.CLOSE
FileDst.CLOSE
END SUB
$ENDIF
FUNCTION TRIM$(Str AS STRING) AS STRING
Result = LTRIM$(RTRIM$(Str))
END FUNCTION
|