2 * Copyright (C) 2012 The CyanogenMod Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.cyanogenmod.filemanager.commands.shell;
19 import com.cyanogenmod.filemanager.commands.CopyExecutable;
20 import com.cyanogenmod.filemanager.console.CommandNotFoundException;
21 import com.cyanogenmod.filemanager.console.ExecutionException;
22 import com.cyanogenmod.filemanager.console.InsufficientPermissionsException;
23 import com.cyanogenmod.filemanager.model.MountPoint;
24 import com.cyanogenmod.filemanager.util.MountPointHelper;
26 import java.text.ParseException;
30 * A class for copy a file or directory.
32 * {@link "http://unixhelp.ed.ac.uk/CGI/man-cgi?cp"}
34 public class CopyCommand extends SyncResultProgram implements CopyExecutable {
36 private static final String ID = "cp"; //$NON-NLS-1$
38 private final String mDst;
41 * Constructor of <code>CopyCommand</code>.
43 * @param src The name of the file or directory to be copied
44 * @param dst The name of the file or directory in which copy the source file or directory
45 * @throws InvalidCommandDefinitionException If the command has an invalid definition
47 public CopyCommand(String src, String dst) throws InvalidCommandDefinitionException {
56 public void parse(String in, String err) throws ParseException {
57 //Release the return object
58 this.mRet = Boolean.TRUE;
65 public Boolean getResult() {
73 public void checkExitCode(int exitCode)
74 throws InsufficientPermissionsException, CommandNotFoundException, ExecutionException {
76 throw new ExecutionException("exitcode != 0"); //$NON-NLS-1$
84 public MountPoint getSrcWritableMountPoint() {
92 public MountPoint getDstWritableMountPoint() {
93 return MountPointHelper.getMountPointFromDirectory(this.mDst);
100 public boolean isIndefinitelyWait() {