I am using this GN code to split apart the filename and extension from a path:
ext = get_path_info(dst, "name")
ext = get_path_info(dst, "extension")
get_path_info considers extensions as "the substring following the last period following the last slash." Is there any way to retrieve "the substring following the first period following the last slash"?
As an example, assume this is your input:
file.cpp.zip
The current GN implementation of get_path_info will split these as "file.cpp" and ".zip". This is totally reasonable for some use cases; unfortunately, for my use case, I need "file" and ".cpp.zip" instead. Is there an API I can use to split the path this way?
Would a FR bug be useful? Or I can probably do it manually via string-splitting instead.
# For input path "file.aa.bb", name will contain "file" and ext will contain ".aa.bb".
# For input path "file.cc", name will contain "file" and ext will contain ".cc".
nameTmp = get_path_info(dst, "name")
name = get_path_info(nameTmp, "name")
ext = get_path_info(nameTmp, "extension")
ext += get_path_info(dst, "extension")