Пример #1
0
        public static Value lib_fileiocommon_directoryCreate(VmContext vm, Value[] args)
        {
            bool          bool1       = false;
            int           i           = 0;
            int           int1        = 0;
            List <string> stringList1 = null;
            Value         hostObject  = args[0];
            string        path        = (string)args[1].internalValue;

            if ((bool)args[2].internalValue)
            {
                int1 = 0;
                if (!FileIOCommonHelper.DirectoryExists(FileIOCommonHelper.GetDirRoot(path)))
                {
                    int1 = 4;
                }
                else
                {
                    stringList1 = new List <string>();
                    bool1       = true;
                    while ((bool1 && !FileIOCommonHelper.DirectoryExists(path)))
                    {
                        stringList1.Add(path);
                        int1 = FileIOCommonHelper.GetDirParent(path, PST_StringBuffer16);
                        path = PST_StringBuffer16[0];
                        if ((int1 != 0))
                        {
                            bool1 = false;
                        }
                    }
                    if (bool1)
                    {
                        i = (stringList1.Count - 1);
                        while ((i >= 0))
                        {
                            path = stringList1[i];
                            int1 = FileIOCommonHelper.CreateDirectory(path);
                            if ((int1 != 0))
                            {
                                i = -1;
                            }
                            i -= 1;
                        }
                    }
                }
            }
            else
            {
                int1 = FileIOCommonHelper.CreateDirectory(path);
            }
            return(Interpreter.Vm.CrayonWrapper.buildInteger(vm.globals, int1));
        }