1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*++
Copyright (c) 2017 Microsoft Corporation
Module Name:
file_path.h
Abstract:
File path functions.
Author:
Nikolaj Bjorner (nbjorner) 2017-11-19
Revision History:
--*/
#pragma once
#include <cstring>
inline char const * get_extension(char const * file_name) {
if (file_name == nullptr)
return nullptr;
char const * last_dot = nullptr;
for (;;) {
char const * tmp = strchr(file_name, '.');
if (tmp == nullptr) {
return last_dot;
}
last_dot = tmp + 1;
file_name = last_dot;
}
}