Diff
Not logged in

Differences From Artifact [d7c9eaa9ed]:

To Artifact [aabbeb9eb9]:


277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
** newpath is on a network share or a FAT derived file system), default to
** creation of a text file with the context of the link.
** Returns 0 on success, 1 on failure.
*/
int win32_symlink(const char *oldpath, const char *newpath){
  fossilStat stat;
  int created = 0;
  DWORD flags = 0;
  wchar_t *zMbcs, *zMbcsOld;

  /* does oldpath exist? is it a dir or a file? */
  zMbcsOld = fossil_utf8_to_path(oldpath, 0);
  if( win32_stat(zMbcsOld, &stat) == 0 ){
    if( stat.st_mode == S_IFDIR ){
      flags = SYMBOLIC_LINK_FLAG_DIRECTORY;
    }
  }

  /* remove newpath before creating the symlink */
  zMbcs = fossil_utf8_to_path(newpath, 0);
  win32_unlink_rmdir(zMbcs);
  if( isVistaOrLater() ){







|






|







277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
** newpath is on a network share or a FAT derived file system), default to
** creation of a text file with the context of the link.
** Returns 0 on success, 1 on failure.
*/
int win32_symlink(const char *oldpath, const char *newpath){
  fossilStat stat;
  int created = 0;
  DWORD flags = 0x2; /*SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE*/
  wchar_t *zMbcs, *zMbcsOld;

  /* does oldpath exist? is it a dir or a file? */
  zMbcsOld = fossil_utf8_to_path(oldpath, 0);
  if( win32_stat(zMbcsOld, &stat) == 0 ){
    if( stat.st_mode == S_IFDIR ){
      flags |= SYMBOLIC_LINK_FLAG_DIRECTORY;
    }
  }

  /* remove newpath before creating the symlink */
  zMbcs = fossil_utf8_to_path(newpath, 0);
  win32_unlink_rmdir(zMbcs);
  if( isVistaOrLater() ){