Commit 6a498e65 authored by Naba Kumar's avatar Naba Kumar

Added double-quotes around file arguments so that filenames with spaces

	* data/properties/anjuta.properties, ada.properties, cpp.properties,
	  java, properties, latex.properties, lua.properties, others.properties,
	  perl.properties:

	  Added double-quotes around file arguments so that
	  filenames with spaces could also work.

	* launcher/anjuta-launcher.c, executer.c:
	  Escaped quotes in the cammand and it's arguments before executing
	  so that args with spaces can also work.
parent 2f417071
2002-01-25 Naba Kumar <kh_naba@users.sourceforge.net>
* data/properties/anjuta.properties, ada.properties, cpp.properties,
java, properties, latex.properties, lua.properties, others.properties,
perl.properties:
Added double-quotes around file arguments so that
filenames with spaces could also work.
* launcher/anjuta-launcher.c, executer.c:
Escaped quotes in the cammand and it's arguments before executing
so that args with spaces can also work.
2002-01-25 Naba Kumar <kh_naba@users.sourceforge.net>
* scripts/*: Added files which I forgot previously.
......
......@@ -90,6 +90,6 @@ style.ada.8=fore:#000000,$(font.monospace),back:#E0C0E0,eolfilled
# Default Commands for handling different file types #
######################################################
command.compile.file.$(file.patterns.ada)=gcc -c $(current.file.name.ext)
command.build.file.$(file.patterns.ada)=gnatmake $(current.file.name)
command.execute.file.$(file.patterns.ada)=$(current.full.filename) $(anjuta.program.arguments)
command.compile.file.$(file.patterns.ada)=gcc -c "$(current.file.name.ext)"
command.build.file.$(file.patterns.ada)=gnatmake "$(current.file.name)"
command.execute.file.$(file.patterns.ada)="$(current.full.filename)" $(anjuta.program.arguments)
......@@ -340,7 +340,7 @@ command.build.tarball=$(make) $(anjuta.make.options) dist
command.build.install=$(make) $(anjuta.make.options) install
command.build.clean=$(make) $(anjuta.make.options) clean
command.build.clean.all=$(make) $(anjuta.make.options) distclean
command.execute.project=./$(project.source.target) $(anjuta.program.arguments)
command.execute.project=./"$(project.source.target)" $(anjuta.program.arguments)
command.terminal=gnome-terminal --command="$(anjuta.current.command)"
anjuta.compiler.flags=-O -g
......
......@@ -174,10 +174,10 @@ braces.cpp.style=10
# Default Commands for handling different file types #
######################################################
command.compile.file.$(file.patterns.c)=gcc $(anjuta.compiler.flags) -c $(current.file.name.ext) -o $(current.file.name).o
command.build.file.$(file.patterns.c)=gcc $(anjuta.compiler.flags) $(anjuta.linker.flags) $(current.file.name.ext) -o $(current.file.name)
command.execute.file.$(file.patterns.c)=$(current.full.filename) $(anjuta.program.arguments)
command.compile.file.$(file.patterns.c)=gcc $(anjuta.compiler.flags) -c "$(current.file.name.ext)" -o "$(current.file.name).o"
command.build.file.$(file.patterns.c)=gcc $(anjuta.compiler.flags) $(anjuta.linker.flags) "$(current.file.name.ext)" -o "$(current.file.name)"
command.execute.file.$(file.patterns.c)="$(current.full.filename)" $(anjuta.program.arguments)
command.compile.file.$(file.patterns.cpp)=g++ $(anjuta.compiler.flags) -c $(current.file.name.ext) -o $(current.file.name).o
command.build.file.$(file.patterns.cpp)=g++ $(anjuta.compiler.flags) $(anjuta.linker.flags) $(current.file.name.ext) -o $(current.file.name)
command.execute.file.$(file.patterns.cpp)=$(current.full.filename) $(anjuta.program.arguments)
command.compile.file.$(file.patterns.cpp)=g++ $(anjuta.compiler.flags) -c "$(current.file.name.ext)" -o "$(current.file.name).o"
command.build.file.$(file.patterns.cpp)=g++ $(anjuta.compiler.flags) $(anjuta.linker.flags) "$(current.file.name.ext)" -o "$(current.file.name)"
command.execute.file.$(file.patterns.cpp)="$(current.full.filename)" $(anjuta.program.arguments)
......@@ -73,6 +73,6 @@ file.is.source.$(file.patterns.js)=1
# Default Commands for handling different file types #
######################################################
command.compile.file.$(file.patterns.java)=javac --verbose $(current.file.name.ext)
command.build.file.$(file.patterns.java)=javac --verbose *.java
command.execute.file.$(file.patterns.java)=java $(current.full.filename)
command.compile.file.$(file.patterns.java)=javac "$(current.file.name.ext)"
command.build.file.$(file.patterns.java)=javac *.java
command.execute.file.$(file.patterns.java)=java "$(current.full.filename)"
......@@ -58,7 +58,7 @@ style.latex.4=$(style.default.comment)
# Default Commands for handling different file types #
######################################################
command.compile.file.$(file.patterns.latex)=latex $(current.file.name.ext)
command.build.file.$(file.patterns.latex)=dvips -f $(current.file.name).dvi > $(current.file.name).ps
command.execute.file.$(file.patterns.latex)=dvips $(current.full.filename).dvi
command.compile.file.$(file.patterns.latex)=latex "$(current.file.name.ext)"
command.build.file.$(file.patterns.latex)=dvips -f "$(current.file.name).dvi" > "$(current.file.name).ps"
command.execute.file.$(file.patterns.latex)=dvips "$(current.full.filename).dvi"
......@@ -64,7 +64,7 @@ style.lua.12=fore:#000000,$(font.monospace),back:#E0C0E0,eolfilled
# Default Commands for handling different file types #
######################################################
command.compile.file.$(file.patterns.lua)=luac -o $(current.file.name).luc $(current.file.name.ext)
command.compile.file.$(file.patterns.lua)=luac -o "$(current.file.name).luc" "$(current.file.name.ext)"
command.build.file.$(file.patterns.lua)=
command.execute.file.$(file.patterns.lua)=lua $(current.full.filename.ext)
command.execute.file.$(file.patterns.lua)=lua "$(current.full.filename.ext)"
......@@ -152,11 +152,10 @@ style.diff.6=fore:#00007F
# Default Commands for handling different file types #
######################################################
command.view.file.$(file.patterns.icon)=gnome-iconedit $(current.file.name.ext)
command.view.file.$(file.patterns.image)=gimp $(current.file.name.ext)
command.view.file.$(file.patterns.html)=gnome-help-browser file:$(current.full.filename.ext)
command.view.file.$(file.patterns.icon)=gnome-iconedit "$(current.file.name.ext)"
command.view.file.$(file.patterns.image)=gimp "$(current.file.name.ext)"
command.view.file.$(file.patterns.html)=gnome-help-browser "file:$(current.full.filename.ext)"
command.open.file.$(file.patterns.icon)=gnome-iconedit $(current.file.name.ext)
command.open.file.$(file.patterns.image)=gimp $(current.file.name.ext)
command.open.file.$(file.patterns.icon)=gnome-iconedit "$(current.file.name.ext)"
command.open.file.$(file.patterns.image)=gimp "$(current.file.name.ext)"
command.open.file.$(file.patterns.html)=
......@@ -136,7 +136,7 @@ braces.perl.style=10
# Default Commands for handling different file types #
######################################################
command.compile.file.$(file.patterns.perl)=perl -c $(current.file.name.ext)
command.compile.file.$(file.patterns.perl)=perl -c "$(current.file.name.ext)"
command.build.file.$(file.patterns.perl)=
command.execute.file.$(file.patterns.perl)=perl $(current.full.filename.ext)
command.execute.file.$(file.patterns.perl)=perl "$(current.full.filename.ext)"
......@@ -95,5 +95,5 @@ braces.python.style=10
command.compile.file.$(file.patterns.py)=
command.build.file.$(file.patterns.py)=
command.execute.file.$(file.patterns.py)=python -u $(current.full.filename.ext)
command.execute.file.$(file.patterns.py)=python -u "$(current.full.filename.ext)"
......@@ -56,5 +56,5 @@ file.interpreted.$(file.patterns.rb)=1
command.compile.file.$(file.patterns.rb)=
command.build.file.$(file.patterns.rb)=
command.execute.file.$(file.patterns.rb)=ruby $(current.full.filename.ext)
command.execute.file.$(file.patterns.rb)=ruby "$(current.full.filename.ext)"
......@@ -27,6 +27,8 @@
#include <stdio.h>
#include <glib.h>
#define DEBUG
int
main (int argc, char **argv)
{
......
......@@ -33,6 +33,8 @@
#include "executer.h"
#include "resources.h"
#define DEBUG
static GtkWidget* create_executer_dialog(Executer*);
static const gchar szRunInTerminalItem[] = {"RunInTerminal"};
......@@ -216,10 +218,31 @@ on_executer_checkbutton_toggled (GtkToggleButton * togglebutton,
e->terminal = gtk_toggle_button_get_active (togglebutton);
}
static gchar*
escape_quotes(gchar* str)
{
gchar buffer[2048];
gint index;
gchar *s = str;
index = 0;
while(s) {
if (index > 2040)
break;
if (*s == '\"' || *s == '\'')
buffer[index++] = '\\';
buffer[index++] = *s;
s++;
}
buffer[index] = '\0';
return g_strdup(buffer);
}
void
executer_execute (Executer * e)
{
gchar *dir, *cmd, *command;
gchar *dir, *cmd, *command, *escaped_cmd;
/* Doing some checks before actualing starting */
if (app->project_dbase->project_is_open) /* Project mode */
......@@ -323,6 +346,19 @@ executer_execute (Executer * e)
dir = g_dirname (te->full_filename);
}
command = g_strconcat ("anjuta_launcher ", cmd, NULL);
#ifdef DEBUG
g_message("Raw Command is: %s", command);
#endif
escaped_cmd = escape_quotes(command);
g_free(command);
command = escaped_cmd;
#ifdef DEBUG
g_message("Raw Command is: %s", command);
#endif
prop_set_with_key (e->props, "anjuta.current.command", command);
string_free (cmd);
......@@ -331,6 +367,11 @@ executer_execute (Executer * e)
cmd = command_editor_get_command (app->command_editor, COMMAND_TERMINAL);
else
cmd = g_strdup (command);
#ifdef DEBUG
g_message("Command is: %s", cmd);
#endif
anjuta_set_execution_dir (dir);
if (dir) chdir (dir);
gnome_execute_shell (dir, cmd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment