MCPcopy Create free account
hub / github.com/creatale/node-dv / convertSepCharsInPath

Function convertSepCharsInPath

deps/leptonica/src/utils2.c:2701–2727  ·  view source on GitHub ↗

--------------------------------------------------------------------* * Special file name operations * *--------------------------------------------------------------------*/ ! * \brief convertSepCharsInPath() * * \param[in] path * \param[in] type UNIX_PATH_SEPCHAR, WIN_PATH_SEPCHAR * \return 0 if OK, 1 on error * * * Notes: * (1

Source from the content-addressed store, hash-verified

2699 * </pre>
2700 */
2701l_int32
2702convertSepCharsInPath(char *path,
2703 l_int32 type)
2704{
2705l_int32 i;
2706size_t len;
2707
2708 PROCNAME("convertSepCharsInPath");
2709 if (!path)
2710 return ERROR_INT("path not defined", procName, 1);
2711 if (type != UNIX_PATH_SEPCHAR && type != WIN_PATH_SEPCHAR)
2712 return ERROR_INT("invalid type", procName, 1);
2713
2714 len = strlen(path);
2715 if (type == UNIX_PATH_SEPCHAR) {
2716 for (i = 0; i < len; i++) {
2717 if (path[i] == '\\')
2718 path[i] = '/';
2719 }
2720 } else { /* WIN_PATH_SEPCHAR */
2721 for (i = 0; i < len; i++) {
2722 if (path[i] == '/')
2723 path[i] = '\\';
2724 }
2725 }
2726 return 0;
2727}
2728
2729
2730/*!

Callers 3

getFilenamesInDirectoryFunction · 0.85
splitPathAtDirectoryFunction · 0.85
genPathnameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected