[Github-comments] [geany/geany] Create project's filename path (#2586)
tivrfoa
notifications at xxxxx
Tue Sep 15 02:09:46 UTC 2020
@tivrfoa commented on this pull request.
> + /* get last path_delimiter so we know the path */
+ int i;
+ int last_path_delimiter;
+ for (i = 0; locale_filename[i] != '\0'; ++i) {
+ if (locale_filename[i] == path_delimiter) {
+ last_path_delimiter = i;
+ }
+ }
+
+ /* get substring containing only the filename path */
+ gchar *filename_path = g_malloc((last_path_delimiter + 2) * sizeof(char));
+ strncpy(filename_path, locale_filename, last_path_delimiter + 1);
+ filename_path[last_path_delimiter + 1] = '\0';
Thank you very much @codebrainz !
The code now is much simpler! I tested on Ubuntu and it worked.
And probably `g_path_get_dirname` already takes care of operating system path delimiter.
--
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/2586#discussion_r488339421
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20200914/6f830322/attachment.htm>
More information about the Github-comments
mailing list