5b220e195b8d3c9d3672dd5a5000edcba2223ee7
[AGL/documentation.git] / docs / 3_Developer_Guides / 4_AFB_Helper_Guide / 5_Filescan_Utils.md
1 ---
2 title: Filescan Utils functions
3 ---
4
5 ## const char *GetMiddleName(const char *name)
6
7 Get rid of the binder name prefix 'afbd-'
8
9 * name will be typically the full binder name
10
11 Returns the process middle name of the running binder.
12
13 ## const char *GetBinderName()
14
15 Get the Binder Name without the prefix set by the AGL appfw 'afbd-'
16
17 Returns the Binder name without the prefix.
18
19 ## json_object* ScanForConfig (const char* searchPath, CtlScanDirModeT mode, const char *prefix, const char *extension)
20
21 Scan a directory searching all files matching pattern: 'prefix*extention'.
22
23 * `searchPath`: directory where to begin the searching.
24 * `mode`: either or not the search will be recursive.
25 * `prefix`: file prefix that will be looking for.
26 * `extention`: file extention that will be looking for.
27
28 Returns a json_object array of object with 2 parts a 'fullpath' describing the
29 fullpath to reach the file and 'filename' containing the matched files.
30
31 ## char *GetAFBRootDirPathUsingFd(int fd)
32
33 Get the binder root directory path (the path specified with '--rootdir' option
34 at binder launch, if the option is not used, the path from where the binder
35 is launched) using binder root directory file descriptor.
36
37 * `fd` : Binder root directory file descriptor.
38
39 Returns a string representing the path to binder root directory.
40
41 ## char *GetAFBRootDirPath(afb_api_t apiHandle)
42
43 For binding with a version >= 3, same as 'GetAFBRootDirPathUsingFd' function,
44 but use pointer to the AFB API as parameter instead of
45 binder root directory file descriptor.
46
47 * `apiHandle` : pointer to the AFB API.
48
49 Returns a string representing the path to binder root directory.
50
51 ## char* GetBindingDirPath()
52
53 For binding with a version <= 2, same as 'GetAFBRootDirPath' function,
54 but the pointer to the AFB API is not needed.
55 Kept for compatibility issues.
56
57 ## char* GetBindingDirPath(afb_api_t api)
58
59 For binding with a version >= 3, same as 'GetAFBRootDirPath' function.
60 Deprecated, please use 'GetAFBRootDirPath' function.
61 Kept for compatibility issues.
62
63 ## char *GetRunningBindingDirPath(afb_api_t api)
64
65 For binding with a version >= 3, get the binding directory path
66 (the path to the directory that contains the binding).
67
68 * `api` : pointer to the AFB API.
69
70 Returns a string representing the path to the binding directory.
71
72 ## const char *getEnvDirList(const char *prefix, const char *suffix)
73
74 Get the environment directory colon separated path list. This take the prefix
75 add the binder's name then the suffix as environment variable name and also
76 search for another variable without the binder's name (so only prefix+suffix).
77
78 * `prefix`: Environment variable prefix
79 * `suffix`: Environment variable suffix
80
81 Returns a string representing a colon separated path list or NULL is case of
82 error or none environment variables found.