]> git.saurik.com Git - wxWidgets.git/blame - wxPython/samples/ide/activegrid/util/fileutils.py
No longer building the C++ version of the OGL lib
[wxWidgets.git] / wxPython / samples / ide / activegrid / util / fileutils.py
CommitLineData
1f780e48
RD
1#----------------------------------------------------------------------------
2# Name: fileutils.py
3# Purpose: Active grid miscellaneous utilities
4#
5# Author: Jeff Norton
6#
7# Created: 12/10/04
8# CVS-ID: $Id$
9# Copyright: (c) 2004-2005 ActiveGrid, Inc.
10# License: wxWindows License
11#----------------------------------------------------------------------------
12
13import os
14
15def createFile(filename, mode='w'):
16 f = None
17 try:
18 f = file(filename, mode)
19 except:
20 os.makedirs(filename[:filename.rindex(os.sep)])
21 f = file(filename, mode)
22 return f
23
24def compareFiles(file1, file2):
25 file1.seek(0)
26 file2.seek(0)
27 while True:
28 line1 = file1.readline()
29 line2 = file2.readline()
30 if (len(line1) == 0):
31 if (len(line2) == 0):
32 return 0
33 else:
34 return -1
35 elif (len(line2) == 0):
36 return -1
37 elif (line1 != line2):
38 return -1
39