@@ -21,6 +21,7 @@ use ffi::{OsStr, OsString};
21
21
use fmt;
22
22
use io;
23
23
use path:: { Path , PathBuf } ;
24
+ use sys;
24
25
use sys:: os as os_imp;
25
26
26
27
/// Returns the current working directory as a `PathBuf`.
@@ -557,7 +558,7 @@ pub struct Args { inner: ArgsOs }
557
558
///
558
559
/// This structure is created through the `std::env::args_os` method.
559
560
#[ stable( feature = "env" , since = "1.0.0" ) ]
560
- pub struct ArgsOs { inner : os_imp :: Args }
561
+ pub struct ArgsOs { inner : sys :: args :: Args }
561
562
562
563
/// Returns the arguments which this program was started with (normally passed
563
564
/// via the command line).
@@ -606,7 +607,7 @@ pub fn args() -> Args {
606
607
/// ```
607
608
#[ stable( feature = "env" , since = "1.0.0" ) ]
608
609
pub fn args_os ( ) -> ArgsOs {
609
- ArgsOs { inner : os_imp :: args ( ) }
610
+ ArgsOs { inner : sys :: args :: args ( ) }
610
611
}
611
612
612
613
#[ stable( feature = "env" , since = "1.0.0" ) ]
@@ -649,6 +650,8 @@ impl DoubleEndedIterator for ArgsOs {
649
650
/// Constants associated with the current target
650
651
#[ stable( feature = "env" , since = "1.0.0" ) ]
651
652
pub mod consts {
653
+ use sys:: env:: os;
654
+
652
655
/// A string describing the architecture of the CPU that is currently
653
656
/// in use.
654
657
///
@@ -673,7 +676,7 @@ pub mod consts {
673
676
/// - unix
674
677
/// - windows
675
678
#[ stable( feature = "env" , since = "1.0.0" ) ]
676
- pub const FAMILY : & ' static str = super :: os:: FAMILY ;
679
+ pub const FAMILY : & ' static str = os:: FAMILY ;
677
680
678
681
/// A string describing the specific operating system in use.
679
682
/// Example value is `linux`.
@@ -692,7 +695,7 @@ pub mod consts {
692
695
/// - android
693
696
/// - windows
694
697
#[ stable( feature = "env" , since = "1.0.0" ) ]
695
- pub const OS : & ' static str = super :: os:: OS ;
698
+ pub const OS : & ' static str = os:: OS ;
696
699
697
700
/// Specifies the filename prefix used for shared libraries on this
698
701
/// platform. Example value is `lib`.
@@ -702,7 +705,7 @@ pub mod consts {
702
705
/// - lib
703
706
/// - `""` (an empty string)
704
707
#[ stable( feature = "env" , since = "1.0.0" ) ]
705
- pub const DLL_PREFIX : & ' static str = super :: os:: DLL_PREFIX ;
708
+ pub const DLL_PREFIX : & ' static str = os:: DLL_PREFIX ;
706
709
707
710
/// Specifies the filename suffix used for shared libraries on this
708
711
/// platform. Example value is `.so`.
@@ -713,7 +716,7 @@ pub mod consts {
713
716
/// - .dylib
714
717
/// - .dll
715
718
#[ stable( feature = "env" , since = "1.0.0" ) ]
716
- pub const DLL_SUFFIX : & ' static str = super :: os:: DLL_SUFFIX ;
719
+ pub const DLL_SUFFIX : & ' static str = os:: DLL_SUFFIX ;
717
720
718
721
/// Specifies the file extension used for shared libraries on this
719
722
/// platform that goes after the dot. Example value is `so`.
@@ -724,7 +727,7 @@ pub mod consts {
724
727
/// - dylib
725
728
/// - dll
726
729
#[ stable( feature = "env" , since = "1.0.0" ) ]
727
- pub const DLL_EXTENSION : & ' static str = super :: os:: DLL_EXTENSION ;
730
+ pub const DLL_EXTENSION : & ' static str = os:: DLL_EXTENSION ;
728
731
729
732
/// Specifies the filename suffix used for executable binaries on this
730
733
/// platform. Example value is `.exe`.
@@ -736,7 +739,7 @@ pub mod consts {
736
739
/// - .pexe
737
740
/// - `""` (an empty string)
738
741
#[ stable( feature = "env" , since = "1.0.0" ) ]
739
- pub const EXE_SUFFIX : & ' static str = super :: os:: EXE_SUFFIX ;
742
+ pub const EXE_SUFFIX : & ' static str = os:: EXE_SUFFIX ;
740
743
741
744
/// Specifies the file extension, if any, used for executable binaries
742
745
/// on this platform. Example value is `exe`.
@@ -746,183 +749,7 @@ pub mod consts {
746
749
/// - exe
747
750
/// - `""` (an empty string)
748
751
#[ stable( feature = "env" , since = "1.0.0" ) ]
749
- pub const EXE_EXTENSION : & ' static str = super :: os:: EXE_EXTENSION ;
750
-
751
- }
752
-
753
- #[ cfg( target_os = "linux" ) ]
754
- mod os {
755
- pub const FAMILY : & ' static str = "unix" ;
756
- pub const OS : & ' static str = "linux" ;
757
- pub const DLL_PREFIX : & ' static str = "lib" ;
758
- pub const DLL_SUFFIX : & ' static str = ".so" ;
759
- pub const DLL_EXTENSION : & ' static str = "so" ;
760
- pub const EXE_SUFFIX : & ' static str = "" ;
761
- pub const EXE_EXTENSION : & ' static str = "" ;
762
- }
763
-
764
- #[ cfg( target_os = "macos" ) ]
765
- mod os {
766
- pub const FAMILY : & ' static str = "unix" ;
767
- pub const OS : & ' static str = "macos" ;
768
- pub const DLL_PREFIX : & ' static str = "lib" ;
769
- pub const DLL_SUFFIX : & ' static str = ".dylib" ;
770
- pub const DLL_EXTENSION : & ' static str = "dylib" ;
771
- pub const EXE_SUFFIX : & ' static str = "" ;
772
- pub const EXE_EXTENSION : & ' static str = "" ;
773
- }
774
-
775
- #[ cfg( target_os = "ios" ) ]
776
- mod os {
777
- pub const FAMILY : & ' static str = "unix" ;
778
- pub const OS : & ' static str = "ios" ;
779
- pub const DLL_PREFIX : & ' static str = "lib" ;
780
- pub const DLL_SUFFIX : & ' static str = ".dylib" ;
781
- pub const DLL_EXTENSION : & ' static str = "dylib" ;
782
- pub const EXE_SUFFIX : & ' static str = "" ;
783
- pub const EXE_EXTENSION : & ' static str = "" ;
784
- }
785
-
786
- #[ cfg( target_os = "freebsd" ) ]
787
- mod os {
788
- pub const FAMILY : & ' static str = "unix" ;
789
- pub const OS : & ' static str = "freebsd" ;
790
- pub const DLL_PREFIX : & ' static str = "lib" ;
791
- pub const DLL_SUFFIX : & ' static str = ".so" ;
792
- pub const DLL_EXTENSION : & ' static str = "so" ;
793
- pub const EXE_SUFFIX : & ' static str = "" ;
794
- pub const EXE_EXTENSION : & ' static str = "" ;
795
- }
796
-
797
- #[ cfg( target_os = "dragonfly" ) ]
798
- mod os {
799
- pub const FAMILY : & ' static str = "unix" ;
800
- pub const OS : & ' static str = "dragonfly" ;
801
- pub const DLL_PREFIX : & ' static str = "lib" ;
802
- pub const DLL_SUFFIX : & ' static str = ".so" ;
803
- pub const DLL_EXTENSION : & ' static str = "so" ;
804
- pub const EXE_SUFFIX : & ' static str = "" ;
805
- pub const EXE_EXTENSION : & ' static str = "" ;
806
- }
807
-
808
- #[ cfg( target_os = "bitrig" ) ]
809
- mod os {
810
- pub const FAMILY : & ' static str = "unix" ;
811
- pub const OS : & ' static str = "bitrig" ;
812
- pub const DLL_PREFIX : & ' static str = "lib" ;
813
- pub const DLL_SUFFIX : & ' static str = ".so" ;
814
- pub const DLL_EXTENSION : & ' static str = "so" ;
815
- pub const EXE_SUFFIX : & ' static str = "" ;
816
- pub const EXE_EXTENSION : & ' static str = "" ;
817
- }
818
-
819
- #[ cfg( target_os = "netbsd" ) ]
820
- mod os {
821
- pub const FAMILY : & ' static str = "unix" ;
822
- pub const OS : & ' static str = "netbsd" ;
823
- pub const DLL_PREFIX : & ' static str = "lib" ;
824
- pub const DLL_SUFFIX : & ' static str = ".so" ;
825
- pub const DLL_EXTENSION : & ' static str = "so" ;
826
- pub const EXE_SUFFIX : & ' static str = "" ;
827
- pub const EXE_EXTENSION : & ' static str = "" ;
828
- }
829
-
830
- #[ cfg( target_os = "openbsd" ) ]
831
- mod os {
832
- pub const FAMILY : & ' static str = "unix" ;
833
- pub const OS : & ' static str = "openbsd" ;
834
- pub const DLL_PREFIX : & ' static str = "lib" ;
835
- pub const DLL_SUFFIX : & ' static str = ".so" ;
836
- pub const DLL_EXTENSION : & ' static str = "so" ;
837
- pub const EXE_SUFFIX : & ' static str = "" ;
838
- pub const EXE_EXTENSION : & ' static str = "" ;
839
- }
840
-
841
- #[ cfg( target_os = "android" ) ]
842
- mod os {
843
- pub const FAMILY : & ' static str = "unix" ;
844
- pub const OS : & ' static str = "android" ;
845
- pub const DLL_PREFIX : & ' static str = "lib" ;
846
- pub const DLL_SUFFIX : & ' static str = ".so" ;
847
- pub const DLL_EXTENSION : & ' static str = "so" ;
848
- pub const EXE_SUFFIX : & ' static str = "" ;
849
- pub const EXE_EXTENSION : & ' static str = "" ;
850
- }
851
-
852
- #[ cfg( target_os = "solaris" ) ]
853
- mod os {
854
- pub const FAMILY : & ' static str = "unix" ;
855
- pub const OS : & ' static str = "solaris" ;
856
- pub const DLL_PREFIX : & ' static str = "lib" ;
857
- pub const DLL_SUFFIX : & ' static str = ".so" ;
858
- pub const DLL_EXTENSION : & ' static str = "so" ;
859
- pub const EXE_SUFFIX : & ' static str = "" ;
860
- pub const EXE_EXTENSION : & ' static str = "" ;
861
- }
862
-
863
- #[ cfg( target_os = "windows" ) ]
864
- mod os {
865
- pub const FAMILY : & ' static str = "windows" ;
866
- pub const OS : & ' static str = "windows" ;
867
- pub const DLL_PREFIX : & ' static str = "" ;
868
- pub const DLL_SUFFIX : & ' static str = ".dll" ;
869
- pub const DLL_EXTENSION : & ' static str = "dll" ;
870
- pub const EXE_SUFFIX : & ' static str = ".exe" ;
871
- pub const EXE_EXTENSION : & ' static str = "exe" ;
872
- }
873
-
874
- #[ cfg( all( target_os = "nacl" , not( target_arch = "le32" ) ) ) ]
875
- mod os {
876
- pub const FAMILY : & ' static str = "unix" ;
877
- pub const OS : & ' static str = "nacl" ;
878
- pub const DLL_PREFIX : & ' static str = "lib" ;
879
- pub const DLL_SUFFIX : & ' static str = ".so" ;
880
- pub const DLL_EXTENSION : & ' static str = "so" ;
881
- pub const EXE_SUFFIX : & ' static str = ".nexe" ;
882
- pub const EXE_EXTENSION : & ' static str = "nexe" ;
883
- }
884
- #[ cfg( all( target_os = "nacl" , target_arch = "le32" ) ) ]
885
- mod os {
886
- pub const FAMILY : & ' static str = "unix" ;
887
- pub const OS : & ' static str = "pnacl" ;
888
- pub const DLL_PREFIX : & ' static str = "lib" ;
889
- pub const DLL_SUFFIX : & ' static str = ".pso" ;
890
- pub const DLL_EXTENSION : & ' static str = "pso" ;
891
- pub const EXE_SUFFIX : & ' static str = ".pexe" ;
892
- pub const EXE_EXTENSION : & ' static str = "pexe" ;
893
- }
894
-
895
- #[ cfg( all( target_os = "emscripten" , target_arch = "asmjs" ) ) ]
896
- mod os {
897
- pub const FAMILY : & ' static str = "unix" ;
898
- pub const OS : & ' static str = "emscripten" ;
899
- pub const DLL_PREFIX : & ' static str = "lib" ;
900
- pub const DLL_SUFFIX : & ' static str = ".so" ;
901
- pub const DLL_EXTENSION : & ' static str = "so" ;
902
- pub const EXE_SUFFIX : & ' static str = ".js" ;
903
- pub const EXE_EXTENSION : & ' static str = "js" ;
904
- }
905
-
906
- #[ cfg( all( target_os = "emscripten" , target_arch = "wasm32" ) ) ]
907
- mod os {
908
- pub const FAMILY : & ' static str = "unix" ;
909
- pub const OS : & ' static str = "emscripten" ;
910
- pub const DLL_PREFIX : & ' static str = "lib" ;
911
- pub const DLL_SUFFIX : & ' static str = ".so" ;
912
- pub const DLL_EXTENSION : & ' static str = "so" ;
913
- pub const EXE_SUFFIX : & ' static str = ".js" ;
914
- pub const EXE_EXTENSION : & ' static str = "js" ;
915
- }
916
-
917
- #[ cfg( target_os = "haiku" ) ]
918
- mod os {
919
- pub const FAMILY : & ' static str = "unix" ;
920
- pub const OS : & ' static str = "haiku" ;
921
- pub const DLL_PREFIX : & ' static str = "lib" ;
922
- pub const DLL_SUFFIX : & ' static str = ".so" ;
923
- pub const DLL_EXTENSION : & ' static str = "so" ;
924
- pub const EXE_SUFFIX : & ' static str = "" ;
925
- pub const EXE_EXTENSION : & ' static str = "" ;
752
+ pub const EXE_EXTENSION : & ' static str = os:: EXE_EXTENSION ;
926
753
}
927
754
928
755
#[ cfg( target_arch = "x86" ) ]
0 commit comments