src/eric7/Documentation/Source/eric7.SystemUtilities.FileSystemUtilities.html

branch
eric7
changeset 10395
16933878e27b
parent 10388
a34ce7f42e8b
child 10399
48014775ad31
equal deleted inserted replaced
10394:056d1b2cd3c4 10395:16933878e27b
164 Public method to convert a path relative to a start path to an 164 Public method to convert a path relative to a start path to an
165 absolute path. 165 absolute path.
166 </p> 166 </p>
167 <dl> 167 <dl>
168 168
169 <dt><i>path</i></dt> 169 <dt><i>path</i> (str)</dt>
170 <dd> 170 <dd>
171 file or directory name to convert (string) 171 file or directory name to convert
172 </dd> 172 </dd>
173 <dt><i>start</i></dt> 173 <dt><i>start</i> (str)</dt>
174 <dd> 174 <dd>
175 start path (string) 175 start path
176 </dd> 176 </dd>
177 </dl> 177 </dl>
178 <dl> 178 <dl>
179 <dt>Return:</dt> 179 <dt>Return:</dt>
180 <dd> 180 <dd>
181 absolute path (string) 181 absolute path
182 </dd>
183 </dl>
184 <dl>
185 <dt>Return Type:</dt>
186 <dd>
187 str
182 </dd> 188 </dd>
183 </dl> 189 </dl>
184 <div align="right"><a href="#top">Up</a></div> 190 <div align="right"><a href="#top">Up</a></div>
185 <hr /> 191 <hr />
186 <hr /> 192 <hr />
192 Public method to convert a path relative to a start path with 198 Public method to convert a path relative to a start path with
193 universal separators to an absolute path. 199 universal separators to an absolute path.
194 </p> 200 </p>
195 <dl> 201 <dl>
196 202
197 <dt><i>path</i></dt> 203 <dt><i>path</i> (str)</dt>
198 <dd> 204 <dd>
199 file or directory name to convert (string) 205 file or directory name to convert
200 </dd> 206 </dd>
201 <dt><i>start</i></dt> 207 <dt><i>start</i> (str)</dt>
202 <dd> 208 <dd>
203 start path (string) 209 start path
204 </dd> 210 </dd>
205 </dl> 211 </dl>
206 <dl> 212 <dl>
207 <dt>Return:</dt> 213 <dt>Return:</dt>
208 <dd> 214 <dd>
209 absolute path with native separators (string) 215 absolute path with native separators
216 </dd>
217 </dl>
218 <dl>
219 <dt>Return Type:</dt>
220 <dd>
221 str
210 </dd> 222 </dd>
211 </dl> 223 </dl>
212 <div align="right"><a href="#top">Up</a></div> 224 <div align="right"><a href="#top">Up</a></div>
213 <hr /> 225 <hr />
214 <hr /> 226 <hr />
219 <p> 231 <p>
220 Function to return a compacted path fitting inside the given width. 232 Function to return a compacted path fitting inside the given width.
221 </p> 233 </p>
222 <dl> 234 <dl>
223 235
224 <dt><i>path</i></dt> 236 <dt><i>path</i> (str)</dt>
225 <dd> 237 <dd>
226 path to be compacted (string) 238 path to be compacted
227 </dd> 239 </dd>
228 <dt><i>width</i></dt> 240 <dt><i>width</i> (int)</dt>
229 <dd> 241 <dd>
230 width for the compacted path (integer) 242 width for the compacted path
231 </dd> 243 </dd>
232 <dt><i>measure</i></dt> 244 <dt><i>measure</i> (function(str))</dt>
233 <dd> 245 <dd>
234 reference to a function used to measure the length of the 246 reference to a function used to measure the length of the
235 string 247 string
236 </dd> 248 </dd>
237 </dl> 249 </dl>
238 <dl> 250 <dl>
239 <dt>Return:</dt> 251 <dt>Return:</dt>
240 <dd> 252 <dd>
241 compacted path (string) 253 compacted path
254 </dd>
255 </dl>
256 <dl>
257 <dt>Return Type:</dt>
258 <dd>
259 str
242 </dd> 260 </dd>
243 </dl> 261 </dl>
244 <div align="right"><a href="#top">Up</a></div> 262 <div align="right"><a href="#top">Up</a></div>
245 <hr /> 263 <hr />
246 <hr /> 264 <hr />
317 </dd> 335 </dd>
318 </dl> 336 </dl>
319 <dl> 337 <dl>
320 <dt>Return Type:</dt> 338 <dt>Return Type:</dt>
321 <dd> 339 <dd>
322 list of strs 340 list of str
323 </dd> 341 </dd>
324 </dl> 342 </dl>
325 <div align="right"><a href="#top">Up</a></div> 343 <div align="right"><a href="#top">Up</a></div>
326 <hr /> 344 <hr />
327 <hr /> 345 <hr />
396 <p> 414 <p>
397 Function returning a list of all directories below path. 415 Function returning a list of all directories below path.
398 </p> 416 </p>
399 <dl> 417 <dl>
400 418
401 <dt><i>path</i></dt> 419 <dt><i>path</i> (str)</dt>
402 <dd> 420 <dd>
403 root of the tree to check 421 root of the tree to check
404 </dd> 422 </dd>
405 <dt><i>excludeDirs</i></dt> 423 <dt><i>excludeDirs</i> (list of str)</dt>
406 <dd> 424 <dd>
407 basename of directories to ignore 425 base name of directories to ignore
408 </dd> 426 </dd>
409 </dl> 427 </dl>
410 <dl> 428 <dl>
411 <dt>Return:</dt> 429 <dt>Return:</dt>
412 <dd> 430 <dd>
413 list of all directories found 431 list of all directories found
432 </dd>
433 </dl>
434 <dl>
435 <dt>Return Type:</dt>
436 <dd>
437 list of str
414 </dd> 438 </dd>
415 </dl> 439 </dl>
416 <div align="right"><a href="#top">Up</a></div> 440 <div align="right"><a href="#top">Up</a></div>
417 <hr /> 441 <hr />
418 <hr /> 442 <hr />
423 <p> 447 <p>
424 Function to build the full path of an executable file from the environment. 448 Function to build the full path of an executable file from the environment.
425 </p> 449 </p>
426 <dl> 450 <dl>
427 451
428 <dt><i>file</i></dt> 452 <dt><i>file</i> (str)</dt>
429 <dd> 453 <dd>
430 filename of the executable to check (string) 454 filename of the executable to check
431 </dd> 455 </dd>
432 </dl> 456 </dl>
433 <dl> 457 <dl>
434 <dt>Return:</dt> 458 <dt>Return:</dt>
435 <dd> 459 <dd>
436 full executable name, if the executable file is accessible 460 full executable name, if the executable file is accessible
437 via the searchpath defined by the PATH environment variable, or an 461 via the executable search path defined by the PATH environment variable, or an
438 empty string otherwise. 462 empty string otherwise.
463 </dd>
464 </dl>
465 <dl>
466 <dt>Return Type:</dt>
467 <dd>
468 str
439 </dd> 469 </dd>
440 </dl> 470 </dl>
441 <div align="right"><a href="#top">Up</a></div> 471 <div align="right"><a href="#top">Up</a></div>
442 <hr /> 472 <hr />
443 <hr /> 473 <hr />
448 <p> 478 <p>
449 Function to build all full path of an executable file from the environment. 479 Function to build all full path of an executable file from the environment.
450 </p> 480 </p>
451 <dl> 481 <dl>
452 482
453 <dt><i>file</i></dt> 483 <dt><i>file</i> (str)</dt>
454 <dd> 484 <dd>
455 filename of the executable (string) 485 filename of the executable
456 </dd> 486 </dd>
457 </dl> 487 </dl>
458 <dl> 488 <dl>
459 <dt>Return:</dt> 489 <dt>Return:</dt>
460 <dd> 490 <dd>
461 list of full executable names (list of strings), if the executable 491 list of full executable names, if the executable file is accessible via
462 file is accessible via the searchpath defined by the PATH environment 492 the executable search path defined by the PATH environment variable, or an
463 variable, or an empty list otherwise. 493 empty list otherwise.
494 </dd>
495 </dl>
496 <dl>
497 <dt>Return Type:</dt>
498 <dd>
499 list of str
464 </dd> 500 </dd>
465 </dl> 501 </dl>
466 <div align="right"><a href="#top">Up</a></div> 502 <div align="right"><a href="#top">Up</a></div>
467 <hr /> 503 <hr />
468 <hr /> 504 <hr />
522 such with the extensions .cmd or .bat and finally the given file name as 558 such with the extensions .cmd or .bat and finally the given file name as
523 is. The first match is returned. 559 is. The first match is returned.
524 </p> 560 </p>
525 <dl> 561 <dl>
526 562
527 <dt><i>file</i></dt> 563 <dt><i>file</i> (str)</dt>
528 <dd> 564 <dd>
529 filename of the executable to check (string) 565 filename of the executable to check
530 </dd> 566 </dd>
531 </dl> 567 </dl>
532 <dl> 568 <dl>
533 <dt>Return:</dt> 569 <dt>Return:</dt>
534 <dd> 570 <dd>
535 full executable name, if the executable file is accessible 571 full executable name, if the executable file is accessible via the
536 via the searchpath defined by the PATH environment variable, or an 572 executable search path defined by the PATH environment variable, or an
537 empty string otherwise. 573 empty string otherwise.
574 </dd>
575 </dl>
576 <dl>
577 <dt>Return Type:</dt>
578 <dd>
579 str
538 </dd> 580 </dd>
539 </dl> 581 </dl>
540 <div align="right"><a href="#top">Up</a></div> 582 <div align="right"><a href="#top">Up</a></div>
541 <hr /> 583 <hr />
542 <hr /> 584 <hr />
605 <p> 647 <p>
606 Function to check, if a file is executable. 648 Function to check, if a file is executable.
607 </p> 649 </p>
608 <dl> 650 <dl>
609 651
610 <dt><i>exe</i></dt> 652 <dt><i>exe</i> (str)</dt>
611 <dd> 653 <dd>
612 filename of the executable to check (string) 654 filename of the executable to check
613 </dd> 655 </dd>
614 </dl> 656 </dl>
615 <dl> 657 <dl>
616 <dt>Return:</dt> 658 <dt>Return:</dt>
617 <dd> 659 <dd>
618 flag indicating executable status (boolean) 660 flag indicating executable status
661 </dd>
662 </dl>
663 <dl>
664 <dt>Return Type:</dt>
665 <dd>
666 bool
619 </dd> 667 </dd>
620 </dl> 668 </dl>
621 <div align="right"><a href="#top">Up</a></div> 669 <div align="right"><a href="#top">Up</a></div>
622 <hr /> 670 <hr />
623 <hr /> 671 <hr />
686 <p> 734 <p>
687 Function to check for an executable file. 735 Function to check for an executable file.
688 </p> 736 </p>
689 <dl> 737 <dl>
690 738
691 <dt><i>file</i></dt> 739 <dt><i>file</i> (str)</dt>
692 <dd> 740 <dd>
693 filename of the executable to check (string) 741 filename of the executable to check
694 </dd> 742 </dd>
695 </dl> 743 </dl>
696 <dl> 744 <dl>
697 <dt>Return:</dt> 745 <dt>Return:</dt>
698 <dd> 746 <dd>
699 flag to indicate, if the executable file is accessible 747 flag indicating, if the executable file is accessible via the executable
700 via the searchpath defined by the PATH environment variable. 748 search path defined by the PATH environment variable.
749 </dd>
750 </dl>
751 <dl>
752 <dt>Return Type:</dt>
753 <dd>
754 bool
701 </dd> 755 </dd>
702 </dl> 756 </dl>
703 <div align="right"><a href="#top">Up</a></div> 757 <div align="right"><a href="#top">Up</a></div>
704 <hr /> 758 <hr />
705 <hr /> 759 <hr />
714 The leading "." of ext is replaced by a platform specific extension 768 The leading "." of ext is replaced by a platform specific extension
715 separator if necessary. 769 separator if necessary.
716 </p> 770 </p>
717 <dl> 771 <dl>
718 772
719 <dt><i>prefix</i></dt> 773 <dt><i>prefix</i> (str)</dt>
720 <dd> 774 <dd>
721 the basepart of the filename (string) 775 the basepart of the filename
722 </dd> 776 </dd>
723 <dt><i>ext</i></dt> 777 <dt><i>ext</i> (str)</dt>
724 <dd> 778 <dd>
725 the extension part (string) 779 the extension part
726 </dd> 780 </dd>
727 </dl> 781 </dl>
728 <dl> 782 <dl>
729 <dt>Return:</dt> 783 <dt>Return:</dt>
730 <dd> 784 <dd>
731 the complete filename (string) 785 the complete filename
786 </dd>
787 </dl>
788 <dl>
789 <dt>Return Type:</dt>
790 <dd>
791 str
732 </dd> 792 </dd>
733 </dl> 793 </dl>
734 <div align="right"><a href="#top">Up</a></div> 794 <div align="right"><a href="#top">Up</a></div>
735 <hr /> 795 <hr />
736 <hr /> 796 <hr />
742 Function returning a normalized, absolute path of the joined parts passed 802 Function returning a normalized, absolute path of the joined parts passed
743 into it. 803 into it.
744 </p> 804 </p>
745 <dl> 805 <dl>
746 806
747 <dt><i>a</i></dt> 807 <dt><i>a</i> (str)</dt>
748 <dd> 808 <dd>
749 first path to be joined (string) 809 first path to be joined
750 </dd> 810 </dd>
751 <dt><i>p</i></dt> 811 <dt><i>p</i> (str)</dt>
752 <dd> 812 <dd>
753 variable number of path parts to be joind (string) 813 variable number of path parts to be joined
754 </dd> 814 </dd>
755 </dl> 815 </dl>
756 <dl> 816 <dl>
757 <dt>Return:</dt> 817 <dt>Return:</dt>
758 <dd> 818 <dd>
759 absolute, normalized path (string) 819 absolute, normalized path
820 </dd>
821 </dl>
822 <dl>
823 <dt>Return Type:</dt>
824 <dd>
825 str
760 </dd> 826 </dd>
761 </dl> 827 </dl>
762 <div align="right"><a href="#top">Up</a></div> 828 <div align="right"><a href="#top">Up</a></div>
763 <hr /> 829 <hr />
764 <hr /> 830 <hr />
770 Function returning an absolute path, that is normalized with respect to 836 Function returning an absolute path, that is normalized with respect to
771 its case and references. 837 its case and references.
772 </p> 838 </p>
773 <dl> 839 <dl>
774 840
775 <dt><i>path</i></dt> 841 <dt><i>path</i> (str)</dt>
776 <dd> 842 <dd>
777 file path (string) 843 file path
778 </dd> 844 </dd>
779 </dl> 845 </dl>
780 <dl> 846 <dl>
781 <dt>Return:</dt> 847 <dt>Return:</dt>
782 <dd> 848 <dd>
783 absolute, normalized path (string) 849 absolute, normalized path
850 </dd>
851 </dl>
852 <dl>
853 <dt>Return Type:</dt>
854 <dd>
855 str
784 </dd> 856 </dd>
785 </dl> 857 </dl>
786 <div align="right"><a href="#top">Up</a></div> 858 <div align="right"><a href="#top">Up</a></div>
787 <hr /> 859 <hr />
788 <hr /> 860 <hr />
794 Function returning a path, that is normalized with respect to its case 866 Function returning a path, that is normalized with respect to its case
795 and references. 867 and references.
796 </p> 868 </p>
797 <dl> 869 <dl>
798 870
799 <dt><i>path</i></dt> 871 <dt><i>path</i> (str)</dt>
800 <dd> 872 <dd>
801 file path (string) 873 file path
802 </dd> 874 </dd>
803 </dl> 875 </dl>
804 <dl> 876 <dl>
805 <dt>Return:</dt> 877 <dt>Return:</dt>
806 <dd> 878 <dd>
807 case normalized path (string) 879 case normalized path
880 </dd>
881 </dl>
882 <dl>
883 <dt>Return Type:</dt>
884 <dd>
885 str
808 </dd> 886 </dd>
809 </dl> 887 </dl>
810 <div align="right"><a href="#top">Up</a></div> 888 <div align="right"><a href="#top">Up</a></div>
811 <hr /> 889 <hr />
812 <hr /> 890 <hr />
817 <p> 895 <p>
818 Function returning a normalized path of the joined parts passed into it. 896 Function returning a normalized path of the joined parts passed into it.
819 </p> 897 </p>
820 <dl> 898 <dl>
821 899
822 <dt><i>a</i></dt> 900 <dt><i>a</i> (str)</dt>
823 <dd> 901 <dd>
824 first path to be joined (string) 902 first path to be joined
825 </dd> 903 </dd>
826 <dt><i>p</i></dt> 904 <dt><i>p</i> (str)</dt>
827 <dd> 905 <dd>
828 variable number of path parts to be joined (string) 906 variable number of path parts to be joined
829 </dd> 907 </dd>
830 </dl> 908 </dl>
831 <dl> 909 <dl>
832 <dt>Return:</dt> 910 <dt>Return:</dt>
833 <dd> 911 <dd>
834 normalized path (string) 912 normalized path
913 </dd>
914 </dl>
915 <dl>
916 <dt>Return Type:</dt>
917 <dd>
918 str
835 </dd> 919 </dd>
836 </dl> 920 </dl>
837 <div align="right"><a href="#top">Up</a></div> 921 <div align="right"><a href="#top">Up</a></div>
838 <hr /> 922 <hr />
839 <hr /> 923 <hr />
874 Function to convert a file path to a path relative to a start path 958 Function to convert a file path to a path relative to a start path
875 with universal separators. 959 with universal separators.
876 </p> 960 </p>
877 <dl> 961 <dl>
878 962
879 <dt><i>path</i></dt> 963 <dt><i>path</i> (str)</dt>
880 <dd> 964 <dd>
881 file or directory name to convert (string) 965 file or directory name to convert
882 </dd> 966 </dd>
883 <dt><i>start</i></dt> 967 <dt><i>start</i> (str)</dt>
884 <dd> 968 <dd>
885 start path (string) 969 start path
886 </dd> 970 </dd>
887 </dl> 971 </dl>
888 <dl> 972 <dl>
889 <dt>Return:</dt> 973 <dt>Return:</dt>
890 <dd> 974 <dd>
891 relative path or unchanged path, if path does not start with 975 relative path or unchanged path, if path does not start with
892 the start path with universal separators (string) 976 the start path with universal separators
977 </dd>
978 </dl>
979 <dl>
980 <dt>Return Type:</dt>
981 <dd>
982 str
893 </dd> 983 </dd>
894 </dl> 984 </dl>
895 <div align="right"><a href="#top">Up</a></div> 985 <div align="right"><a href="#top">Up</a></div>
896 <hr /> 986 <hr />
897 <hr /> 987 <hr />
924 <div align="right"><a href="#top">Up</a></div> 1014 <div align="right"><a href="#top">Up</a></div>
925 <hr /> 1015 <hr />
926 <hr /> 1016 <hr />
927 <a NAME="samefilepath" ID="samefilepath"></a> 1017 <a NAME="samefilepath" ID="samefilepath"></a>
928 <h2>samefilepath</h2> 1018 <h2>samefilepath</h2>
929 <b>samefilepath</b>(<i>f1, f2</i>) 1019 <b>samefilepath</b>(<i>f1, f2, followSymlinks=True</i>)
930 1020
931 <p> 1021 <p>
932 Function to compare two paths. Strips the filename. 1022 Function to compare two paths. Strips the filename.
933 </p> 1023 </p>
934 <dl> 1024 <dl>
935 1025
936 <dt><i>f1</i></dt> 1026 <dt><i>f1</i> (str)</dt>
937 <dd> 1027 <dd>
938 first filepath for the compare (string) 1028 first filepath for the compare
939 </dd> 1029 </dd>
940 <dt><i>f2</i></dt> 1030 <dt><i>f2</i> (str)</dt>
941 <dd> 1031 <dd>
942 second filepath for the compare (string) 1032 second filepath for the compare
1033 </dd>
1034 <dt><i>followSymlinks</i> (bool (optional))</dt>
1035 <dd>
1036 flag indicating to respect symbolic links for the comparison
1037 (i.e. compare the real paths) (defaults to True)
943 </dd> 1038 </dd>
944 </dl> 1039 </dl>
945 <dl> 1040 <dl>
946 <dt>Return:</dt> 1041 <dt>Return:</dt>
947 <dd> 1042 <dd>
948 flag indicating whether the two paths represent the 1043 flag indicating whether the two paths represent the
949 same path on disk. 1044 same path on disk
1045 </dd>
1046 </dl>
1047 <dl>
1048 <dt>Return Type:</dt>
1049 <dd>
1050 bool
950 </dd> 1051 </dd>
951 </dl> 1052 </dl>
952 <div align="right"><a href="#top">Up</a></div> 1053 <div align="right"><a href="#top">Up</a></div>
953 <hr /> 1054 <hr />
954 <hr /> 1055 <hr />
955 <a NAME="samepath" ID="samepath"></a> 1056 <a NAME="samepath" ID="samepath"></a>
956 <h2>samepath</h2> 1057 <h2>samepath</h2>
957 <b>samepath</b>(<i>f1, f2</i>) 1058 <b>samepath</b>(<i>f1, f2, followSymlinks=True</i>)
958 1059
959 <p> 1060 <p>
960 Function to compare two paths. 1061 Function to compare two paths.
961 </p> 1062 </p>
962 <dl> 1063 <dl>
963 1064
964 <dt><i>f1</i></dt> 1065 <dt><i>f1</i> (str)</dt>
965 <dd> 1066 <dd>
966 first path for the compare (string) 1067 first filepath for the compare
967 </dd> 1068 </dd>
968 <dt><i>f2</i></dt> 1069 <dt><i>f2</i> (str)</dt>
969 <dd> 1070 <dd>
970 second path for the compare (string) 1071 second filepath for the compare
1072 </dd>
1073 <dt><i>followSymlinks</i> (bool (optional))</dt>
1074 <dd>
1075 flag indicating to respect symbolic links for the comparison
1076 (i.e. compare the real paths) (defaults to True)
971 </dd> 1077 </dd>
972 </dl> 1078 </dl>
973 <dl> 1079 <dl>
974 <dt>Return:</dt> 1080 <dt>Return:</dt>
975 <dd> 1081 <dd>
976 flag indicating whether the two paths represent the 1082 flag indicating whether the two paths represent the
977 same path on disk. 1083 same path on disk
1084 </dd>
1085 </dl>
1086 <dl>
1087 <dt>Return Type:</dt>
1088 <dd>
1089 bool
978 </dd> 1090 </dd>
979 </dl> 1091 </dl>
980 <div align="right"><a href="#top">Up</a></div> 1092 <div align="right"><a href="#top">Up</a></div>
981 <hr /> 1093 <hr />
982 <hr /> 1094 <hr />
987 <p> 1099 <p>
988 Function to split a pathname into a directory part and a file part. 1100 Function to split a pathname into a directory part and a file part.
989 </p> 1101 </p>
990 <dl> 1102 <dl>
991 1103
992 <dt><i>name</i></dt> 1104 <dt><i>name</i> (str)</dt>
993 <dd> 1105 <dd>
994 path name (string) 1106 path name
995 </dd> 1107 </dd>
996 </dl> 1108 </dl>
997 <dl> 1109 <dl>
998 <dt>Return:</dt> 1110 <dt>Return:</dt>
999 <dd> 1111 <dd>
1000 a tuple of 2 strings (dirname, filename). 1112 tuple containing directory name and file name
1113 </dd>
1114 </dl>
1115 <dl>
1116 <dt>Return Type:</dt>
1117 <dd>
1118 tuple of (str, str)
1001 </dd> 1119 </dd>
1002 </dl> 1120 </dl>
1003 <div align="right"><a href="#top">Up</a></div> 1121 <div align="right"><a href="#top">Up</a></div>
1004 <hr /> 1122 <hr />
1005 <hr /> 1123 <hr />

eric ide

mercurial