[Github-comments] [geany/geany] use relative path in project file (#2667)

Keuronde notifications at xxxxx
Fri Nov 20 19:03:41 UTC 2020


@Keuronde commented on this pull request.



>  
 	if (ft == NULL) /* can happen when saving a new file when quitting */
 		ft = filetypes[GEANY_FILETYPES_NONE];
 
-	locale_filename = utils_get_locale_from_utf8(doc->file_name);
+	/* project_root_folder contain a path only if the project use relative path */
+	if(project_root_folder){
+		file_root_folder = g_file_new_for_path(project_root_folder);
+		file_doc = g_file_new_for_path(doc->file_name);
+		relative_filename = g_file_get_relative_path(file_root_folder, file_doc);
+		if(relative_filename){
+			/* Append './' so we know it is a relative filename */
+			doc_filename = g_strconcat("./",relative_filename, NULL);

Make sense, I will change the behavior, I don't need to store "./" at the  beginning of the path.

-- 
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/pull/2667#discussion_r527912787
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20201120/c1a11196/attachment.htm>


More information about the Github-comments mailing list