File tree Expand file tree Collapse file tree
app/src/main/java/com/njlabs/showjava/ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -270,8 +270,13 @@ private void cleanOldSources() {
270270 for (File file : files ) {
271271 if (!file .getName ().equalsIgnoreCase ("sources" )) {
272272 try {
273- FileUtils .cleanDirectory (file );
274- file .delete ();
273+ if (file .exists ()){
274+ if (file .isDirectory ()){
275+ FileUtils .deleteDirectory (file );
276+ } else {
277+ file .delete ();
278+ }
279+ }
275280 } catch (Exception e ) {
276281 Ln .d (e );
277282 }
@@ -329,12 +334,19 @@ protected List<SourceInfo> doInBackground(String... params) {
329334 } else {
330335 if (!Utils .isProcessorServiceRunning (baseContext )) {
331336 try {
332- FileUtils .deleteDirectory (file );
333- } catch (IOException e ) {
337+ if (file .exists ()){
338+ if (file .isDirectory ()){
339+ FileUtils .deleteDirectory (file );
340+ } else {
341+ file .delete ();
342+ }
343+ }
344+
345+ } catch (Exception e ) {
334346 Ln .d (e );
335347 }
336348 }
337- if (!file .isDirectory ()) {
349+ if (file . exists ()&& !file .isDirectory ()) {
338350 file .delete ();
339351 }
340352 }
You can’t perform that action at this time.
0 commit comments