| 165 | // This has not been tested for every possible combination but seems to work. |
| 166 | |
| 167 | void makepath( |
| 168 | char* path, // out |
| 169 | const char* drive, // in: can be NULL, will append ":" if necessary |
| 170 | const char* dir, // in: can be NULL, will append "/" if necessary |
| 171 | const char* base, // in: can be NULL, |
| 172 | const char* ext) // in: can be NULL, will prepend "." if necessary |
| 173 | { |
| 174 | CV_Assert(path); |
| 175 | |
| 176 | char* p = path; |
| 177 | if (drive && *drive) |
| 178 | { |
| 179 | *p++ = *drive; |
| 180 | *p++ = ':'; |
| 181 | } |
| 182 | if (dir && *dir) |
| 183 | { |
| 184 | strncpy_(p, dir, _MAX_DIR); |
| 185 | p += STRNLEN(dir, _MAX_DIR); |
| 186 | if (*(p-1) != '/' && *(p-1) != '\\') |
| 187 | *p++ = '/'; |
| 188 | } |
| 189 | if (base && *base) |
| 190 | { |
| 191 | strncpy_(p, base, _MAX_FNAME); |
| 192 | p += STRNLEN(base, _MAX_FNAME); |
| 193 | } |
| 194 | if (ext && *ext) |
| 195 | { |
| 196 | if (*ext != '.') |
| 197 | *p++ = '.'; |
| 198 | strncpy_(p, ext, _MAX_EXT); |
| 199 | p += STRNLEN(ext, _MAX_EXT); |
| 200 | } |
| 201 | *p = 0; |
| 202 | } |
| 203 | |
| 204 | void LogShape( // print mat to log file, this is mostly for debugging and testing |
| 205 | const MAT& mat, // in |