Changeset ef9e54e3fdea5f50be28da38b8c9801828bedec2
- Timestamp:
- 09/05/10 01:31:22 (3 years ago)
- Author:
- Nedko Arnaudov <nedko@…>
- Children:
- 7eaf2d172909418013d8e9cf19812bc6906cc2ad
- Parents:
- c5acbafc8f666d9cbc7c81f01deb0a3db01b22d4
- git-committer:
- Nedko Arnaudov <nedko@arnaudov.name> / 2010-09-05T01:31:22Z+0300
- Message:
-
daemon: implement deduction of project dir from project name and vice versa
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
rb251c7a
|
ref9e54e
|
|
| 30 | 30 | #include <fcntl.h> |
| 31 | 31 | #include <unistd.h> |
| | 32 | #include <libgen.h> /* POSIX basename() */ |
| 32 | 33 | |
| 33 | 34 | #include "room_internal.h" |
| … |
… |
|
| 224 | 225 | char * old_project_dir; |
| 225 | 226 | char * old_project_name; |
| | 227 | char * buffer; |
| 226 | 228 | bool ret; |
| 227 | 229 | |
| … |
… |
|
| 253 | 255 | { |
| 254 | 256 | ASSERT(!name_supplied); |
| 255 | | /* TODO */ |
| 256 | | log_error("Deducing project name from project dir is not implemented yet"); |
| 257 | | goto exit; |
| | 257 | |
| | 258 | buffer = strdup(project_dir_param); |
| | 259 | if (buffer == NULL) |
| | 260 | { |
| | 261 | log_error("strdup() failed for project dir"); |
| | 262 | goto exit; |
| | 263 | } |
| | 264 | |
| | 265 | project_name = basename(buffer); |
| | 266 | log_info("Project name for dir '%s' will be '%s'", project_dir_param, project_name); |
| | 267 | project_name = strdup(project_name); |
| | 268 | free(buffer); |
| | 269 | project_dir = strdup(project_dir_param); /* buffer cannot be used because it may be modified by basename() */ |
| 258 | 270 | } |
| 259 | 271 | else if (name_supplied) |
| 260 | 272 | { |
| 261 | 273 | ASSERT(!dir_supplied); |
| 262 | | /* TODO */ |
| 263 | | log_error("Deducing project dir from project name is not implemented yet"); |
| 264 | | goto exit; |
| | 274 | |
| | 275 | project_dir = catdup3(getenv("HOME"), "/ladish-projects/", project_name_param); /* TODO: this must be a runtime setting */ |
| | 276 | if (project_dir == NULL) |
| | 277 | { |
| | 278 | log_error("catdup3() failed to compose project name"); |
| | 279 | goto exit; |
| | 280 | } |
| | 281 | |
| | 282 | log_info("Project dir for name '%s' will be '%s'", project_name_param, project_dir); |
| | 283 | |
| | 284 | project_name = strdup(project_name_param); |
| 265 | 285 | } |
| 266 | 286 | else |