| | 594 | /*! @brief Check if file or directory exists. No check for regular file! |
|---|
| | 595 | * |
|---|
| | 596 | * @param file filename or fullpath of file/directory |
|---|
| | 597 | * @returns TRUE if exists, FALSE otherwise |
|---|
| | 598 | * |
|---|
| | 599 | */ |
|---|
| | 600 | osync_bool osync_testing_file_exists(const char *file) |
|---|
| | 601 | { |
|---|
| | 602 | return g_file_test(file, G_FILE_TEST_EXISTS); |
|---|
| | 603 | } |
|---|
| | 604 | |
|---|
| | 605 | /*! @brief Removes files and directories |
|---|
| | 606 | * |
|---|
| | 607 | * @param file filename or fullpath of file/directory |
|---|
| | 608 | * @returns TRUE on success, FALSE otherwise |
|---|
| | 609 | * |
|---|
| | 610 | */ |
|---|
| | 611 | osync_bool osync_testing_file_remove(const char *file) |
|---|
| | 612 | { |
|---|
| | 613 | return g_remove(file); |
|---|
| | 614 | } |
|---|
| | 615 | |
|---|
| | 616 | /*! @brief Modifies permission of file - like chmod() |
|---|
| | 617 | * |
|---|
| | 618 | * @param file filename or fullpath of file |
|---|
| | 619 | * @param mode the permission mode like chmod() |
|---|
| | 620 | * @returns TRUE on success, FALSE otherwise |
|---|
| | 621 | * |
|---|
| | 622 | */ |
|---|
| | 623 | osync_bool osync_testing_file_chmod(const char *file, int mode) |
|---|
| | 624 | { |
|---|
| | 625 | /* GLib 2.16.3 Note: |
|---|
| | 626 | "[...] Software that needs to manage file |
|---|
| | 627 | permissions on Windows exactly should use the Win32 API." |
|---|
| | 628 | TODO: Do we have to care about this on Windows?! */ |
|---|
| | 629 | return g_chmod(file, mode); |
|---|
| | 630 | } |
|---|