Skip to content

Commit 9f356e0

Browse files
committed
Move build binary file to build dir
1 parent 002b099 commit 9f356e0

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

app/src/main/java/com/duy/ccppcompiler/compiler/compilers/GCCCompiler.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ public GCCCompiler(Context context, @Nullable ICompileSetting compileSetting) {
5353
public GccCommandResult compile(File[] sourceFiles) {
5454
File sourceFile = sourceFiles[0];
5555
String command = buildCommand(sourceFiles);
56-
String workingDir = sourceFile.getParent();
5756

58-
GccCommandResult result = new GccCommandResult(execCommand(mContext, workingDir, command));
57+
GccCommandResult result = new GccCommandResult(execCommand(mContext, sourceFile.getParent(), command));
5958
if (result.getResultCode() == 0) {
6059
if (mOutFile.exists()) {
6160
try {
@@ -80,9 +79,12 @@ public GccCommandResult compile(File[] sourceFiles) {
8079
}
8180

8281
protected String buildCommand(File[] sourceFiles) {
83-
File file = sourceFiles[0];
84-
String fileName = file.getName();
85-
mOutFile = new File(file.getParent(), fileName.substring(0, fileName.lastIndexOf(".")));
82+
File source = sourceFiles[0];
83+
String fileName = source.getName();
84+
85+
File buildDir = new File(source.getParent(), "build");
86+
buildDir.mkdir();
87+
mOutFile = new File(buildDir, fileName.substring(0, fileName.lastIndexOf(".")));
8688

8789
CommandBuilder builder = new CommandBuilder(COMPILER_NAME);
8890
for (File sourceFile : sourceFiles) {

app/src/main/java/com/duy/ccppcompiler/packagemanager/Environment.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,13 @@ public static String[] buildDefaultEnv(Context context) {
143143
final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
144144
final TermSettings settings = new TermSettings(context.getResources(), pref);
145145
final String cctoolsDir = getCCtoolsDir(context);
146+
final String tmpExeDir = getTmpExeDir(context);
146147

147148
return new String[]{
148-
"TMPDIR=" + getTmpExeDir(context),
149-
"TMPEXEDIR=" + getTmpExeDir(context),
150-
"TEMPDIR=" + getTmpExeDir(context),
151-
"TEMP=" + getTmpExeDir(context),
149+
"TMPDIR=" + tmpExeDir,
150+
"TMPEXEDIR=" + tmpExeDir,
151+
"TEMPDIR=" + tmpExeDir,
152+
"TEMP=" + tmpExeDir,
152153
"PATH=" + joinPath(cctoolsDir + "/bin", cctoolsDir + "/sbin", System.getenv("PATH")),
153154
"HOME=" + getHomeDir(context),
154155

app/src/main/java/com/duy/editor/theme/EditorThemeFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
103103
Buffer buffer = new Buffer();
104104
Highlighter highlighter = new Highlighter();
105105
editorView.setTheme(editorTheme);
106-
editorView.setSelection(10);
107106

108107
buffer.setMode(Catalog.getModeByName("C++"), mContext);
109108
editorView.setText(new SpannableStringBuilder());
110109
editorView.getText().insert(0, getSampleData());
110+
111111
buffer.setEditable(editorView.getText());
112112
buffer.insert(0, getSampleData());
113113

0 commit comments

Comments
 (0)