Можно ли использовать электрон-апдейтер с электрон-кузницей?

Я не уверен, но я тоже сеял этот код. эта треска будет работать быстрее и, на мой взгляд, просто. просто загрузите каталог кеша приложений и удалите все файлы в каталоге

public boolean clearCache() {
    try {

        // create an array object of File type for referencing of cache files   
        File[] files = getBaseContext().getCacheDir().listFiles();

        // use a for etch loop to delete files one by one
        for (File file : files) {

             /* you can use just [ file.delete() ] function of class File
              * or use if for being sure if file deleted
              * here if file dose not delete returns false and condition will
              * will be true and it ends operation of function by return 
              * false then we will find that all files are not delete
              */
             if (!file.delete()) {
                 return false;         // not success
             }
        }

        // if for loop completes and process not ended it returns true   
        return true;      // success of deleting files

    } catch (Exception e) {}

    // try stops deleting cache files
    return false;       // not success 
}

Он получает все файлы кеша в массиве файлов getBaseContext (). getCacheDir (). listFiles (), а затем удаляет один за другим в цикл методом file.delet ()

0
задан jayarjo 5 March 2019 в 05:39
поделиться