• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 
17 package com.googlecode.android_scripting.interpreter.shell;
18 
19 import com.googlecode.android_scripting.interpreter.Interpreter;
20 import com.googlecode.android_scripting.language.ShellLanguage;
21 
22 import java.io.File;
23 
24 /**
25  * Represents the shell.
26  *
27  */
28 public class ShellInterpreter extends Interpreter {
29   private final static String SHELL_BIN = "/system/bin/sh";
30 
ShellInterpreter()31   public ShellInterpreter() {
32     setExtension(".sh");
33     setName("sh");
34     setNiceName("Shell");
35     setBinary(new File(SHELL_BIN));
36     setInteractiveCommand("");
37     setScriptCommand("%s");
38     setLanguage(new ShellLanguage());
39     setHasInteractiveMode(true);
40   }
41 
hasInterpreterArchive()42   public boolean hasInterpreterArchive() {
43     return false;
44   }
45 
hasExtrasArchive()46   public boolean hasExtrasArchive() {
47     return false;
48   }
49 
hasScriptsArchive()50   public boolean hasScriptsArchive() {
51     return false;
52   }
53 
getVersion()54   public int getVersion() {
55     return 0;
56   }
57 
58   @Override
isUninstallable()59   public boolean isUninstallable() {
60     return false;
61   }
62 
63   @Override
isInstalled()64   public boolean isInstalled() {
65     return true;
66   }
67 }
68