Here you can find the source of deleteLockFile(Path logFile)
Parameter | Description |
---|---|
logFile | the file for which the lock should be deleted |
Parameter | Description |
---|---|
IOException | if the lock file could not be deleted |
public static void deleteLockFile(Path logFile) throws IOException
//package com.java2s; /*/*w w w. j a v a 2s .co m*/ * BasePlugin * Copyright (C) 2014 Viciouss <http://www.doncarnage.de> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA */ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; public class Main { /** * Removes any lck files for the given log file. * * @param logFile the file for which the lock should be deleted * @throws IOException if the lock file could not be deleted */ public static void deleteLockFile(Path logFile) throws IOException { String lockFileName = logFile.getFileName().toString().concat(".lck"); Path parent = logFile.getParent(); Path lockFile; if (parent == null) { lockFile = Paths.get(lockFileName); } else { lockFile = parent.resolve(lockFileName); } Files.deleteIfExists(lockFile); } }