From: Olivier G. <og...@us...> - 2006-02-01 19:26:10
|
Update of /cvsroot/osmose-dev/osmose/src/osmose/application/file In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9843/src/osmose/application/file Modified Files: OSMFile.java Log Message: Files from Osmose 0.1 can be read by Osmose 0.2. Index: OSMFile.java =================================================================== RCS file: /cvsroot/osmose-dev/osmose/src/osmose/application/file/OSMFile.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** OSMFile.java 30 Aug 2005 17:44:15 -0000 1.1.1.1 --- OSMFile.java 1 Feb 2006 19:25:57 -0000 1.2 *************** *** 307,318 **** public boolean verifySoftwareVersion(String version) { ! // in fact we check the first numbers of the version // for example, soft version is 0.1.31 and file version is 0.1.28 // then we authorized osmose to open the file ! // (when the soft version will be 0.2.0 and file version 0.1.40 it will be wrong) boolean bRet = false; ! int indexVersion = version.lastIndexOf("."); ! String truncateVersion = version.substring(0,indexVersion); ! if(OSMApplication.OSM_VERSION.startsWith(truncateVersion)) { bRet = true; --- 307,325 ---- public boolean verifySoftwareVersion(String version) { ! // in fact we check the first two numbers of the version // for example, soft version is 0.1.31 and file version is 0.1.28 // then we authorized osmose to open the file ! // A file with a greater version than the software cannot be opened. boolean bRet = false; ! ! String[] fileVersion = version.split("\\."); ! String[] softVersion = OSMApplication.OSM_VERSION.split("\\."); ! int fileVersion0 = new Integer(fileVersion[0]).intValue(); ! int fileVersion1 = new Integer(fileVersion[1]).intValue(); ! int softVersion0 = new Integer(softVersion[0]).intValue(); ! int softVersion1 = new Integer(softVersion[1]).intValue(); ! ! if ( (fileVersion0 < softVersion0) ! || (fileVersion0==softVersion0 && fileVersion1<=softVersion1)) { bRet = true; |