X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/510bb7480c5138dd5127ed3d8b1d9cbab39983c9..1f780e48af479e7bf9a07eaaa1ab6b41f1ffb17b:/wxPython/samples/ide/activegrid/util/fileutils.py diff --git a/wxPython/samples/ide/activegrid/util/fileutils.py b/wxPython/samples/ide/activegrid/util/fileutils.py new file mode 100644 index 0000000000..7d334c7dde --- /dev/null +++ b/wxPython/samples/ide/activegrid/util/fileutils.py @@ -0,0 +1,39 @@ +#---------------------------------------------------------------------------- +# Name: fileutils.py +# Purpose: Active grid miscellaneous utilities +# +# Author: Jeff Norton +# +# Created: 12/10/04 +# CVS-ID: $Id$ +# Copyright: (c) 2004-2005 ActiveGrid, Inc. +# License: wxWindows License +#---------------------------------------------------------------------------- + +import os + +def createFile(filename, mode='w'): + f = None + try: + f = file(filename, mode) + except: + os.makedirs(filename[:filename.rindex(os.sep)]) + f = file(filename, mode) + return f + +def compareFiles(file1, file2): + file1.seek(0) + file2.seek(0) + while True: + line1 = file1.readline() + line2 = file2.readline() + if (len(line1) == 0): + if (len(line2) == 0): + return 0 + else: + return -1 + elif (len(line2) == 0): + return -1 + elif (line1 != line2): + return -1 +