[Github-comments] [geany/geany-plugins] Markdown: Fix relative paths (#501)

Matthew Brush notifications at xxxxx
Fri Nov 11 21:05:25 UTC 2016


codebrainz commented on this pull request.



> +    GError *error = NULL;
+    GeanyDocument *doc = document_get_current();
+
+    /* If the current document has a known path (ie. is saved), use that,
+     * substituting the file's basename for `index.html`. */
+    if (DOC_VALID(doc) && doc->real_path != NULL) {
+      gchar *base_dir = g_path_get_dirname(doc->real_path);
+      base_path = g_build_filename(base_dir, "index.html", NULL);
+      g_free(base_dir);
+    }
+    /* Otherwise assume use a file `index.html` in the current working directory. */
+    else {
+      gchar *cwd = g_get_current_dir();
+      base_path = g_build_filename(cwd, "index.html", NULL);
+      g_free(cwd);
+      g_debug("current document is not saved, using '%s' as base filename", base_path);

Yeah, true, if each re-render.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/501
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20161111/8dc295c1/attachment.html>


More information about the Github-comments mailing list