exists() public method

public exists ( ) : bool
return bool
示例#1
0
        //////////////////////////////////////////////////////////////////////////
        // Sys Config
        //////////////////////////////////////////////////////////////////////////

        private static Map initSysConfig()
        {
            try
            {
                string    path = FileUtil.combine(m_homeDir, "etc", "sys", "config.props");
                LocalFile f    = new LocalFile(new FileInfo(path));

                if (f.exists())
                {
                    try
                    {
                        return(f.readProps());
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("ERROR: Invalid props file: " + f);
                        Console.WriteLine("  " + e);
                    }
                }
            }
            catch (Exception e)
            {
                throw initFail("sysConfig", e);
            }
            return(m_emptyStrStrMap);
        }
示例#2
0
        public override File moveTo(File to)
        {
            if (isDir() != to.isDir())
            {
                if (isDir())
                {
                    throw ArgErr.make("moveTo must be dir `" + to + "`").val;
                }
                else
                {
                    throw ArgErr.make("moveTo must not be dir `" + to + "`").val;
                }
            }

            if (!(to is LocalFile))
            {
                throw IOErr.make("Cannot move LocalFile to " + to.@typeof()).val;
            }
            LocalFile dest = (LocalFile)to;

            if (dest.exists())
            {
                throw IOErr.make("moveTo already exists: " + to).val;
            }

            try
            {
                if (m_file is FileInfo)
                {
                    (m_file as FileInfo).MoveTo((dest.m_file as FileInfo).FullName);
                }
                else
                {
                    (m_file as DirectoryInfo).MoveTo((dest.m_file as DirectoryInfo).FullName);
                }
            }
            catch (System.IO.IOException)
            {
                throw IOErr.make("moveTo failed: " + to).val;
            }

            return(to);
        }
示例#3
0
文件: Sys.cs 项目: nomit007/f4
        //////////////////////////////////////////////////////////////////////////
        // Sys Config
        //////////////////////////////////////////////////////////////////////////
        private static Map initSysConfig()
        {
            try
              {
            string path = FileUtil.combine(m_homeDir, "etc", "sys", "config.props");
            LocalFile f = new LocalFile(new FileInfo(path));

            if (f.exists())
            {
              try
              {
            return f.readProps();
              }
              catch (Exception e)
              {
            Console.WriteLine("ERROR: Invalid props file: " + f);
            Console.WriteLine("  " + e);
              }
            }
              }
              catch (Exception e)
              {
            throw initFail("sysConfig", e);
              }
              return m_emptyStrStrMap;
        }