Subversion Repositories SmartDukaan

Rev

Rev 2367 | Rev 2433 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2367 Rev 2369
Line 123... Line 123...
123
    	}	
123
    	}	
124
    }
124
    }
125
    
125
    
126
 
126
 
127
    
127
    
128
	public boolean deleteDir(File dir) {
128
	public boolean cleanDir(File dir, boolean deleteSelf) {
129
	    if (dir.isDirectory()) {
129
	    if (dir.isDirectory()) {
130
	        String[] children = dir.list();
130
	        String[] children = dir.list();
131
	        for (int i=0; i<children.length; i++) {
131
	        for (int i=0; i<children.length; i++) {
132
	            boolean success = deleteDir(new File(dir, children[i]));
132
	            boolean success = cleanDir(new File(dir, children[i]), true);
133
	            if (!success) {
133
	            if (!success) {
134
	                return false;
134
	                return false;
135
	            }
135
	            }
136
	        }
136
	        }
137
	    }
137
	    }
138
	    // The directory is now empty so delete it
138
	    // The directory is now empty so delete it
-
 
139
	    if(deleteSelf){
139
	    return dir.delete();
140
	    	return dir.delete();
-
 
141
	    }
-
 
142
	    return true;
140
	}
143
	}
141
	
144
	
142
	
145
	
143
	private void removeOldResources() throws IOException{
146
	private void removeOldResources() throws IOException{
144
		File f = new File(Utils.EXPORT_SOLR_PATH);
147
		File f = new File(Utils.EXPORT_SOLR_PATH);
145
		if(f.exists()){
148
		if(f.exists()){
146
			deleteDir(f);
149
			cleanDir(f, false);
147
		}
150
		}
148
		f.createNewFile();
-
 
149
		f.mkdir();
-
 
150
		
151
		
151
		File f1 = new File(Utils.EXPORT_ENTITIES_PATH_LOCALHOST);
152
		File f1 = new File(Utils.EXPORT_ENTITIES_PATH_LOCALHOST);
152
		if(f1.exists()){
153
		if(f1.exists()){
153
			deleteDir(f1);
154
			cleanDir(f1, false);
154
		}
155
		}
155
		f1.createNewFile();
-
 
156
		f1.mkdir();
-
 
157
		
156
		
158
		File f2 = new File(Utils.EXPORT_ENTITIES_PATH_SAHOLIC);
157
		File f2 = new File(Utils.EXPORT_ENTITIES_PATH_SAHOLIC);
159
		if(f2.exists()){
158
		if(f2.exists()){
160
			deleteDir(f2);
159
			cleanDir(f2, false);
161
		}
160
		}
162
		f2.createNewFile();
-
 
163
		f2.mkdir();
-
 
164
		
161
		
165
		File f3 = new File(Utils.EXPORT_ENTITIES_PATH_SHOP2020);
162
		File f3 = new File(Utils.EXPORT_ENTITIES_PATH_SHOP2020);
166
		if(f3.exists()){
163
		if(f3.exists()){
167
			deleteDir(f3);
164
			cleanDir(f3, false);
168
		}
165
		}
169
		f3.createNewFile();
-
 
170
		f3.mkdir();
-
 
171
	}
166
	}
172
	
167
	
173
    /**
168
    /**
174
     * Update the prices in the generated content
169
     * Update the prices in the generated content
175
     * @throws Exception
170
     * @throws Exception