Ejemplo n.º 1
0
        private static string FindGemBinPath(string /*!*/ ironRubyBinPath)
        {
            string result;

            result = Environment.GetEnvironmentVariable("GEM_PATH");
            if (Directory.Exists(result))
            {
                return(result);
            }

            try {
                result = Path.Combine(RubyUtils.GetHomeDirectory(PlatformAdaptationLayer.Default), @"ironruby\1.9.1\bin");
                if (Directory.Exists(result))
                {
                    return(result);
                }
            } catch {
                // ignore
            }

            result = Path.Combine(ironRubyBinPath, @"Lib\ironruby\gems\1.9.1");
            if (Directory.Exists(result))
            {
                return(result);
            }

            result = Path.Combine(ironRubyBinPath, @"bin");
            if (Directory.Exists(result))
            {
                return(result);
            }

            return(null);
        }
Ejemplo n.º 2
0
 private static void SetHome()
 {
     try {
         PlatformAdaptationLayer platform = PlatformAdaptationLayer.Default;
         string homeDir = RubyUtils.GetHomeDirectory(platform);
         platform.SetEnvironmentVariable("HOME", homeDir);
     } catch (System.Security.SecurityException e) {
         // Ignore EnvironmentPermission exception
         if (e.PermissionType != typeof(System.Security.Permissions.EnvironmentPermission))
         {
             throw;
         }
     }
 }
Ejemplo n.º 3
0
Archivo: Dir.cs Proyecto: ltwlf/IronSP
        public static object ChangeDirectory(BlockParam block, RubyClass /*!*/ self)
        {
#if !SILVERLIGHT
            string defaultDirectory = RubyUtils.GetHomeDirectory(self.Context.Platform);
            if (defaultDirectory == null)
            {
                throw RubyExceptions.CreateArgumentError("HOME / USERPROFILE not set");
            }

            return(ChangeDirectory(block, self, self.Context.EncodePath(defaultDirectory)));
#else
            throw new InvalidOperationException();
#endif
        }