Changeset 5320

Show
Ignore:
Timestamp:
02/28/08 08:13:31 (6 months ago)
Author:
morris
Message:

Add wi_file_symlink() and wi_file_set_mode()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libwired/trunk/libwired/file/wi-file.c

    r5164 r5320  
    246246 
    247247 
     248wi_boolean_t wi_file_symlink(wi_string_t *frompath, wi_string_t *topath) { 
     249        if(symlink(wi_string_cstring(frompath), wi_string_cstring(topath)) < 0) { 
     250                wi_error_set_errno(errno); 
     251                 
     252                return false; 
     253        } 
     254         
     255        return true; 
     256} 
     257 
     258 
     259 
    248260wi_boolean_t wi_file_copy(wi_string_t *frompath, wi_string_t *topath) { 
    249261        struct stat             sb; 
     
    381393 
    382394 
     395wi_boolean_t wi_file_set_mode(wi_string_t *path, mode_t mode) { 
     396        if(chmod(wi_string_cstring(path), mode) < 0) { 
     397                wi_error_set_errno(errno); 
     398                 
     399                return false; 
     400        } 
     401         
     402        return true; 
     403} 
     404 
     405 
     406 
    383407wi_boolean_t wi_file_stat(wi_string_t *path, struct stat *sp) { 
    384408        if(stat(wi_string_cstring(path), sp) < 0) { 
  • libwired/trunk/libwired/file/wi-file.h

    r4656 r5320  
    7575WI_EXPORT wi_boolean_t                          wi_file_clear(wi_string_t *); 
    7676WI_EXPORT wi_boolean_t                          wi_file_rename(wi_string_t *, wi_string_t *); 
     77WI_EXPORT wi_boolean_t                          wi_file_symlink(wi_string_t *, wi_string_t *); 
    7778WI_EXPORT wi_boolean_t                          wi_file_copy(wi_string_t *, wi_string_t *); 
    7879WI_EXPORT wi_boolean_t                          wi_file_stat(wi_string_t *, struct stat *); 
     
    8182WI_EXPORT wi_boolean_t                          wi_file_exists(wi_string_t *, wi_boolean_t *); 
    8283WI_EXPORT wi_boolean_t                          wi_file_create_directory(wi_string_t *, mode_t); 
     84WI_EXPORT wi_boolean_t                          wi_file_set_mode(wi_string_t *, mode_t); 
    8385WI_EXPORT wi_boolean_t                          wi_file_is_alias(wi_string_t *); 
    8486WI_EXPORT wi_boolean_t                          wi_file_is_alias_cpath(const char *);