Edit

kc3-lang/libxkbcommon/src/utils-paths.c

Branch :

  • Show log

    Commit

  • Author : Pierre Le Marre
    Date : 2025-06-06 20:27:45
    Hash : 16c079d6
    Message : chore: Rename is_absolute to is_absolute_path

  • src/utils-paths.c
  • /*
     * Copyright © 2024 Pierre Le Marre
     * SPDX-License-Identifier: MIT
     */
    
    #include "config.h"
    
    #include "utils.h"
    #include "utils-paths.h"
    
    
    /* Caller must ensure that the input is not NULL or empty */
    bool
    is_absolute_path(const char *path)
    {
    #ifdef _WIN32
        /*
         * A file name is relative to the current directory if it does not begin with
         * one of the following:
         * - A UNC name of any format, which always start with two backslash characters ("\\").
         * - A disk designator with a backslash, for example "C:\" or "d:\".
         * - A single backslash, for example, "\directory" or "\file.txt".
         * See: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file
         */
        return is_path_separator(path[0]) ||
               (strlen_safe(path) >= 3 && path[1] == ':' && is_path_separator(path[2]));
    #else
        return is_path_separator(path[0]);
    #endif
    }