[gnome-latex: 39/205] Open files from the command line with relative path



commit f8ada1c76575f864365002a3b03561c589782d93
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date:   Thu Sep 3 17:21:04 2009 +0200

    Open files from the command line with relative path
    
    Before, we could already use absolute path:
    latexila /home/seb/test.tex
    
    Now, we can use relative path to open documents from the command line:
    latexila test.tex minimal.tex

 ChangeLog  |  2 +-
 TODO       | 25 ++++++++++++++++++++++---
 src/main.c | 17 +++++++++++++++--
 3 files changed, 38 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 879f048..bfbb162 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
 ChangeLog LaTeXila
 
-* Release 0.0.1 (Sept ?, 2009)
+* Release 0.0.1 (Sept 2, 2009)
        Added:
        - Syntaxic color
        - Buttons to compile, convert and view the document
diff --git a/TODO b/TODO
index daf3f45..3c06e86 100644
--- a/TODO
+++ b/TODO
@@ -1,9 +1,28 @@
 TODO LaTeXila
 
-Mon Aug 24, 2009 to Mon Aug 31, 2009
+Thu Sep 3, 2009 to Thu Sep 10, 2009
+
+[-] new toolbar
+       - structure: part, chapter, section, subsection, subsubsection, paragraph, subparagraph
+       - font styles
+       - size of characters
+       - bold, italic, typewriter, underline
+       - center
+       - lists: itemize, enumerate, description
+       - various: label, ref, pageref, cite, footnote, index
+
+[-] symbol tables
+       - Greek letters
+       - arrows
+       - relation
+       - operators
+       - miscellaneous math
+       - miscellaneous text
+       - delimiters
+       - ...
 
 [-] bugs correction
        - sometimes command output is not UTF-8:
          Gtk-CRITICAL **: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text, len, NULL)' failed
-
-[-] ubuntu package
+       x open files from the command line:
+         can not open relative path, only absolute
diff --git a/src/main.c b/src/main.c
index 46d2619..3ad2b5d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -405,11 +405,24 @@ main (int argc, char *argv[])
        /* open documents given in arguments */
        for (int i = 1 ; i < argc ; i++)
        {
-               gchar *uri = g_filename_to_uri (argv[i], NULL, NULL);
+               gchar *path;
+               if (g_path_is_absolute (argv[i]))
+                       path = g_strdup (argv[i]);
+               else
+               {
+                       gchar *current_dir = g_get_current_dir ();
+                       path = g_strdup_printf ("%s/%s", current_dir, argv[i]);
+                       g_free (current_dir);
+               }
+
+               gchar *uri = g_filename_to_uri (path, NULL, NULL);
                if (uri != NULL)
-                       open_new_document (argv[i], uri);
+                       open_new_document (path, uri);
                else
                        print_warning ("can not open the file \"%s\"", argv[i]);
+
+               g_free (path);
+               g_free (uri);
        }
 
        gtk_main ();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]