Edit

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

Branch :

  • Show log

    Commit

  • Author : Pierre Le Marre
    Date : 2024-09-16 16:09:11
    Hash : 7697c712
    Message : rules: Resolve relative include statements using XKB paths Contrary to keymap files, the `! include` statement in rules does not lookup include paths added to `xkb_context`. So it is not possible e.g. to import another file in the same folder without using an absolute path. - Added path utils: `is_absolute(path)`. - Added XKB paths lookup to enable e.g. `! include evdev` to work. - Added test.

  • src/utils-paths.h
  • #ifndef UTILS_PATHS_H
    #define UTILS_PATHS_H
    
    #include <stdbool.h>
    
    #ifdef _WIN32
    #define PATH_SEPARATOR '\\'
    #define ALT_PATH_SEPARATOR '/'
    #define is_path_separator(s) \
        ((s) == PATH_SEPARATOR || (s) == ALT_PATH_SEPARATOR)
    #else
    #define PATH_SEPARATOR '/'
    #define is_path_separator(s) ((s) == PATH_SEPARATOR)
    #endif
    
    bool
    is_absolute(const char *path);
    
    #endif