Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Bug-fix in file_relative_name(): If filename is a super-directory of the current directory then the final slash is missing. Test-case: "fossil test-relative-name /home/ --slash". Result "../../.." should be "../../../". This bugfix is needed for my next commit. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
add752453332cdc3bc72ef19be3ce8b4 |
| User & Date: | jan.nijtmans 2013-09-19 11:18:33.974 |
Context
|
2013-09-19
| ||
| 11:29 | Notepad and Cygwin interpret absolute paths differently. Solution: make the path relative. This is generally better anyway because relative paths are shorter and less likely to overflow platform path limitations. check-in: 3cadf76c3d user: jan.nijtmans tags: trunk | |
| 11:18 | Bug-fix in file_relative_name(): If filename is a super-directory of the current directory then the final slash is missing. Test-case: "fossil test-relative-name /home/ --slash". Result "../../.." should be "../../../". This bugfix is needed for my next commit. check-in: add7524533 user: jan.nijtmans tags: trunk | |
| 08:30 | Add --slash option to test-canonical-name and test-relative-name check-in: e6ced76797 user: jan.nijtmans tags: trunk | |
Changes
Changes to src/file.c.
| ︙ | ︙ | |||
875 876 877 878 879 880 881 |
i = 1;
#if defined(_WIN32) || defined(__CYGWIN__)
while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++;
#else
while( zPath[i] && zPwd[i]==zPath[i] ) i++;
#endif
if( zPath[i]==0 ){
| | | | > > > > | 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 |
i = 1;
#if defined(_WIN32) || defined(__CYGWIN__)
while( zPath[i] && fossil_tolower(zPwd[i])==fossil_tolower(zPath[i]) ) i++;
#else
while( zPath[i] && zPwd[i]==zPath[i] ) i++;
#endif
if( zPath[i]==0 ){
memcpy(&tmp, pOut, sizeof(tmp));
if( zPwd[i]==0 ){
blob_set(pOut, ".");
}else{
blob_set(pOut, "..");
for(j=i+1; zPwd[j]; j++){
if( zPwd[j]=='/' ){
blob_append(pOut, "/..", 3);
}
}
}
if( slash && i>0 && zPath[strlen(zPath)-1]=='/'){
blob_append(pOut, "/", 1);
}
blob_reset(&tmp);
return;
}
if( zPwd[i]==0 && zPath[i]=='/' ){
memcpy(&tmp, pOut, sizeof(tmp));
blob_set(pOut, "./");
blob_append(pOut, &zPath[i+1], -1);
blob_reset(&tmp);
|
| ︙ | ︙ |