Here you can find the source of copyFilePermissions(File source, File target)
Parameter | Description |
---|---|
source | a parameter |
target | a parameter |
private static void copyFilePermissions(File source, File target)
//package com.java2s; /* MOD_V2.0/* w ww . ja v a2 s .c o m*/ * Copyright (c) 2012 OpenDA Association * All rights reserved. * * This file is part of OpenDA. * * OpenDA 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. * * OpenDA 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 OpenDA. If not, see <http://www.gnu.org/licenses/>. */ import java.io.*; public class Main { /** * Sets the file permissions of the given source file * on the given target file. * * @param source * @param target */ private static void copyFilePermissions(File source, File target) { if (source.canRead()) { target.setReadable(true, false); } else { target.setReadable(false, false); } if (source.canWrite()) { target.setWritable(true, false); } else { target.setWritable(false, false); } if (source.canExecute()) { target.setExecutable(true, false); } else { target.setExecutable(false, false); } } }