Fossil

Check-in [b293b744db]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix file_simplify_name and file_is_absolute_path for cygwin
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | ticket-d17d6e5b17
Files: files | file ages | folders
SHA1: b293b744db4fc5cb37e4e654f5882c866fe28910
User & Date: jan.nijtmans 2013-01-27 21:56:18.215
Context
2013-01-28
13:09
win32: files with invalid chars were not deleted sometimes with "fossil update" check-in: d9aa512e20 user: jan.nijtmans tags: ticket-d17d6e5b17
2013-01-27
21:56
Fix file_simplify_name and file_is_absolute_path for cygwin check-in: b293b744db user: jan.nijtmans tags: ticket-d17d6e5b17
21:31
merge trunk check-in: 8df9d37834 user: jan.nijtmans tags: ticket-d17d6e5b17
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/file.c.
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
  *pJ = i-1;
  return 1;
}

/*
** Simplify a filename by
**
**  * Convert all \ into / on windows
**  * removing any trailing and duplicate /
**  * removing /./
**  * removing /A/../
**
** Changes are made in-place.  Return the new name length.
** If the slash parameter is non-zero, the trailing slash, if any,
** is retained.
*/
int file_simplify_name(char *z, int n, int slash){
  int i, j;
  if( n<0 ) n = strlen(z);

  /* On windows convert all \ characters to / */
#if defined(_WIN32)
  for(i=0; i<n; i++){
    if( z[i]=='\\' ) z[i] = '/';
  }
#endif

  /* Removing trailing "/" characters */
  if( !slash ){







|












|
|







575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
  *pJ = i-1;
  return 1;
}

/*
** Simplify a filename by
**
**  * Convert all \ into / on windows and cygwin
**  * removing any trailing and duplicate /
**  * removing /./
**  * removing /A/../
**
** Changes are made in-place.  Return the new name length.
** If the slash parameter is non-zero, the trailing slash, if any,
** is retained.
*/
int file_simplify_name(char *z, int n, int slash){
  int i, j;
  if( n<0 ) n = strlen(z);

  /* On windows/cygwin convert all \ characters to / */
#if defined(_WIN32) || defined(__CYGWIN__)
  for(i=0; i<n; i++){
    if( z[i]=='\\' ) z[i] = '/';
  }
#endif

  /* Removing trailing "/" characters */
  if( !slash ){
700
701
702
703
704
705
706
707


708
709
710
711
712
713
714

/*
** Return true if zPath is an absolute pathname.  Return false
** if it is relative.
*/
int file_is_absolute_path(const char *zPath){
  if( zPath[0]=='/'
#if defined(_WIN32)


      || zPath[0]=='\\'
      || (strlen(zPath)>3 && zPath[1]==':'
           && (zPath[2]=='\\' || zPath[2]=='/'))
#endif
  ){
    return 1;
  }else{







|
>
>







700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716

/*
** Return true if zPath is an absolute pathname.  Return false
** if it is relative.
*/
int file_is_absolute_path(const char *zPath){
  if( zPath[0]=='/'
#if defined(__CYGWIN__)
      || zPath[0]=='\\'
#elif defined(_WIN32)
      || zPath[0]=='\\'
      || (strlen(zPath)>3 && zPath[1]==':'
           && (zPath[2]=='\\' || zPath[2]=='/'))
#endif
  ){
    return 1;
  }else{