Diff
Not logged in

Differences From Artifact [4fd897f444]:

To Artifact [0ab8fce870]:


173
174
175
176
177
178
179












180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
      /* all done, close the reparse point */
      CloseHandle(file);
    }
  }

  return rv;
}













int win32_symlink(const char *oldpath, const char *newpath){
  fossilStat stat;
  int created = 0;
  DWORD flags = 0;
  wchar_t *zMbcs;

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

  /* remove newpath before creating the symlink */
  zMbcs = fossil_utf8_to_filename(newpath);
  if (win32_stat(zMbcs, &stat) == 0){
    if (stat.st_mode == S_IFDIR)
      RemoveDirectory(newpath);
    else
      DeleteFile(newpath);
  }
  fossil_filename_free(zMbcs);

  if (CreateSymbolicLink(newpath, oldpath, flags))
    created = 1;

  /* if the symlink was not created, create a plain text file */
  if (!created){







>
>
>
>
>
>
>
>
>
>
>
>

















|
<
<
<
<
<







173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209





210
211
212
213
214
215
216
      /* all done, close the reparse point */
      CloseHandle(file);
    }
  }

  return rv;
}

int win32_unlink_rmdir(const wchar_t *zFilename){
  int rc = -1;
  fossilStat stat;
  if (win32_stat(zFilename, &stat) == 0){
    if (stat.st_mode == S_IFDIR)
      rc = RemoveDirectoryW(zFilename) ? 0 : -1;
    else
      rc = DeleteFileW(zFilename) ? 0 : -1;
  }
  return rc;
}

int win32_symlink(const char *oldpath, const char *newpath){
  fossilStat stat;
  int created = 0;
  DWORD flags = 0;
  wchar_t *zMbcs;

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

  /* remove newpath before creating the symlink */
  zMbcs = fossil_utf8_to_filename(newpath);
  win32_unlink_rmdir(zMbcs);





  fossil_filename_free(zMbcs);

  if (CreateSymbolicLink(newpath, oldpath, flags))
    created = 1;

  /* if the symlink was not created, create a plain text file */
  if (!created){