OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 65 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 65 Rev 156
Line 107... Line 107...
107
        for (int i = 0; i < EXTS.length; i++) {
107
        for (int i = 0; i < EXTS.length; i++) {
108
            final String ext = EXTS[i];
108
            final String ext = EXTS[i];
109
            final File from = getFile(templateId + ext, language, type);
109
            final File from = getFile(templateId + ext, language, type);
110
            final File to = getLocalFile(templateId + ext, language, type);
110
            final File to = getLocalFile(templateId + ext, language, type);
111
            try {
111
            try {
-
 
112
                if (from != null && to != null && from.exists() && !to.exists()) {
-
 
113
                    final File parentDir = to.getParentFile();
-
 
114
                    if (parentDir != null) {
112
                if (from.exists() && !to.exists()) {
115
                        if (!parentDir.exists()) {
-
 
116
                            parentDir.mkdirs();
-
 
117
                        }
113
                    FileUtils.copyFile(from, to);
118
                        FileUtils.copyFile(from, to);
114
                }
119
                    }
-
 
120
                }
115
            } catch (IOException e) {
121
            } catch (IOException e) {
116
                throw new IllegalStateException("Copie impossible", e);
122
                throw new IllegalStateException("Copie impossible", e);
117
            }
123
            }
118
        }
124
        }
119
    }
125
    }
Line 138... Line 144...
138
    @Override
144
    @Override
139
    public void restore(String templateId, String language, String type) {
145
    public void restore(String templateId, String language, String type) {
140
        for (int i = 0; i < EXTS.length; i++) {
146
        for (int i = 0; i < EXTS.length; i++) {
141
            final String ext = EXTS[i];
147
            final String ext = EXTS[i];
142
            final File local = getLocalFile(templateId + ext, language, type);
148
            final File local = getLocalFile(templateId + ext, language, type);
143
            if (local.exists()) {
149
            if (local != null && local.exists()) {
144
                local.delete();
150
                local.delete();
145
                ensureDelete(local);
151
                ensureDelete(local);
146
            }
152
            }
147
        }
153
        }
148
    }
154
    }