CodeEdit icon indicating copy to clipboard operation
CodeEdit copied to clipboard

🐞 The document could not be opened

Open Angelk90 opened this issue 2 years ago • 18 comments

Describe the bug When I try to open this project, it only happens with this specific one from what I have seen so far, it gives me the following error.

I don't understand what caused it.

Screenshots Schermata 2022-03-27 alle 22 11 39

Desktop (please complete the following information):

  • CodeEdit: 1.0 (1)
  • MacOS: 12.3 (21E230)
  • Xcode: 13.3 (13E113)

Angelk90 avatar Mar 27 '22 20:03 Angelk90

I'm getting the same error when opening certain directories, this is the error code

NSUnderlyingError=0x60000192a3d0 {Error Domain=NSPOSIXErrorDomain Code=20 "Not a directory"

armartinez avatar Mar 28 '22 10:03 armartinez

@armartinez : Error does not print me, the console target what is set to when it gives you error: Schermata 2022-03-29 alle 00 35 06

The strange thing is that if I try to open a dir that is inside the one I want to open, it opens it.

Angelk90 avatar Mar 28 '22 22:03 Angelk90

What does the file path look like? Is it happening for other folders with a similar path too? What if you move the folder to a different location?

lukepistrol avatar Mar 29 '22 00:03 lukepistrol

@lukepistrol : It seems that it only happens with this folder, but if I try as I said to open a folder that is inside it works, it opens the internal folder for me.

Angelk90 avatar Mar 29 '22 00:03 Angelk90

Is the folder read or write protected? please attach the output when you ls -l the parent directory in terminal

lukepistrol avatar Mar 29 '22 00:03 lukepistrol

@lukepistrol : drwxr-xr-x@ 28 nameUser staff 896 27 Mar 15:26 sol

Angelk90 avatar Mar 29 '22 00:03 Angelk90

@lukepistrol : The weird thing I had tried long ago to open it, it had opened it worked.

Angelk90 avatar Mar 29 '22 00:03 Angelk90

Nothing unusual here.

Is it some kind of system folder? like the user folder, desktop, documents, etc.?

Please share the pwd

lukepistrol avatar Mar 29 '22 00:03 lukepistrol

@lukepistrol : I had document printed here when I access the folder returns nil.

https://github.com/CodeEditApp/CodeEdit/blob/cb856a1d4ad2bb933b16a4a6c52d3f68486fefc5/CodeEdit/Documents/CodeEditDocumentController.swift#L28

it's just a folder on the desktop: /Users/nameUser/Desktop/sol

Angelk90 avatar Mar 29 '22 00:03 Angelk90

what is the error?

can you do print(document, documentWasAlreadyOpen, error)?

lukepistrol avatar Mar 29 '22 00:03 lukepistrol

@lukepistrol :

nil 

false 

Optional(Error Domain=NSCocoaErrorDomain Code=256 "The document “sol” could not be opened. " UserInfo={NSLocalizedDescription=The document “sol” could not be opened. , NSURL=file:///Users/nameUser/Desktop/sol/macos/Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/Resources, NSFilePath=/Users/nameUser/Desktop/sol/macos/Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/Resources, NSUnderlyingError=0x600002cff3f0 {Error Domain=NSCocoaErrorDomain Code=256 "The file “Resources” couldn’t be opened." UserInfo={NSURL=file:///Users/nameUser/Desktop/sol/macos/Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/Resources, NSFilePath=/Users/nameUser/Desktop/sol/macos/Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/Resources, NSUnderlyingError=0x600002cff3c0 {Error Domain=NSPOSIXErrorDomain Code=20 "Not a directory"}}}})

Angelk90 avatar Mar 29 '22 00:03 Angelk90

Could it be that some of the sub folders /Users/nameUser/Desktop/sol/macos/Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/Resources in particular are stored in iCloud and are not actually downloaded to your machine at the moment?

lukepistrol avatar Mar 29 '22 01:03 lukepistrol

I exclude it I don't use icloud.

I think it depends on the type of file called Resources. You can give it a try to see if it works for you. Download the project, run this command on the project: yarn && npx pod-install macos Then try to access the folder, to see what happens.

Link: project

Angelk90 avatar Mar 29 '22 01:03 Angelk90

Will do tomorrow.

lukepistrol avatar Mar 29 '22 01:03 lukepistrol

@Angelk90 @lukepistrol I think the problem relates to Aliases, if you open them directly they work, but if you open the parent folder, it looks like the openDocument method treats them as folders when they are really files therefore it throws the error I shared. To solve this we need to either submit an issue to Apple or reimplement this openDocument method.

armartinez avatar Mar 29 '22 13:03 armartinez

@lukepistrol Has this been fixed?

nanashili avatar Apr 20 '22 18:04 nanashili

Is this still a problem?

austincondiff avatar Jun 01 '22 23:06 austincondiff

@austincondiff yes

armartinez avatar Jun 03 '22 15:06 armartinez