src/System.Management.Automation/engine/hostifaces/HostUtilities.cs
/// <summary>
/// Used to get all profile file names for the current or all hosts and for the current or all users.
/// </summary>
/// <param name="shellId">null for all hosts, not null for the specified host</param>
/// <param name="forCurrentUser">false for all users, true for the current user.</param>
/// <param name="useTestProfile">used from test not to overwrite the profile file names from development boxes</param>
/// <returns>The profile file name matching the parameters.</returns>
Used to get all profile file names for the current or all hosts and for the current or all users.
Used to get all profile file names for the current or all hosts and for the current or all users .
internal static string GetFullProfileFileName(string shellId, bool forCurrentUser, bool useTestProfile)
        {
            string basePath = null;
            if (forCurrentUser)
            {
#if UNIX
                basePath = Platform.SelectProductNameForDirectory(Platform.XDG_Type.CONFIG);   
#else
                basePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                basePath = IO.Path.Combine(basePath, Utils.ProductNameForDirectory);
#endif
            }
            else
            {
                basePath = GetAllUsersFolderPath(shellId);
                if (string.IsNullOrEmpty(basePath))
                {
                    return "";
                }
            }
            string profileName = useTestProfile ? "profile_test.ps1" : "profile.ps1";
            if (!string.IsNullOrEmpty(shellId))
            {
                profileName = shellId + "_" + profileName;
            }
            string fullPath = basePath = IO.Path.Combine(basePath, profileName);
            return fullPath;
        }
internal static string GetFullProfileFileName ( string shellId , bool forCurrentUser , bool useTestProfile ) { string basePath = null ; if ( forCurrentUser ) { if UNIX basePath = Platform . SelectProductNameForDirectory ( Platform . XDG_Type . CONFIG ) ; else basePath = Environment . GetFolderPath ( Environment . SpecialFolder . Personal ) ; basePath = IO . Path . Combine ( basePath , Utils . ProductNameForDirectory ) ; endif } else { basePath = GetAllUsersFolderPath ( shellId ) ; if ( string . IsNullOrEmpty ( basePath ) ) { return " " ; } } string profileName = useTestProfile ? " " : " " ; if ( ! string . IsNullOrEmpty ( shellId ) ) { profileName = shellId + " " + profileName ; } string fullPath = basePath = IO . Path . Combine ( basePath , profileName ) ; return fullPath ; }
Used to get all profile file names for the current or all hosts and for the current or all users.
Used to get all profile file names for the current or all hosts and for the current or all users .
The profile file name matching the parameters.
The profile file name matching the parameters .
shellId
string
null for all hosts, not null for the specified host
null for all hosts not null for the specified host
forCurrentUser
bool
false for all users, true for the current user.
false for all users true for the current user .
useTestProfile
bool
used from test not to overwrite the profile file names from development boxes
used from test not to overwrite the profile file names from development boxes