q55x8x / Peronality-Creator

Sort of DevEnvironment for teaseAI personalities
4 stars 1 forks source link

Renaming when file is not open creates an imaginary new file in project view #35

Closed q55x8x closed 9 years ago

q55x8x commented 9 years ago

(File that was renamed was newtest2.txt) screenshot1 As shown here when renaming while the file is not open the opening the renamed file opens a "new" empty file hat is empty but still the file to rename actually gets the rename applied as shown here: screenshot2 also in this case newtes_t2.txt has content in it. After closing the editor then opening the renamed file the content will be displayed correctly.

q55x8x commented 9 years ago

just for remembering what I did till now: I've been searching through the open stuff looking for a missing set of a tag but haven't found anything by now. But I think this may be a reference problem as some of the code tries to read from an old reference though I haven't found anything that would produce one.

q55x8x commented 9 years ago

Been digging a bit further into and just had a breakthrough renaming the file alters all references correctly so the renaming it seems correct. Although when opening a file that has been renamed successfully (checked that in win explorer) something strange happens in here:

        public string Read()
        {
            if(this.File.Exists)
                return ReadAllText(this.File.FullName);
            return "";
        }

Although this.File points to the existing renamed file File.Exists is false :confused:

q55x8x commented 9 years ago

Finally fixed by replacing the above mentioned with:

        public string Read()
        {
            if(System.IO.File.Exists(this.File.FullName))
                return System.IO.File.ReadAllText(this.File.FullName);
            return "";
        }