getPaths() does not return Project Path #13860
Comments
I would like to know if my report is being ignored because I haven't done any of the prerequisite stuff, or simply because no one knows what to say. I would not be able to reproduce the problem in safe mode, since the very nature of the problem is something safe mode would prevent happening, and I read over the debugging guide and FAQ's. There was some interesting stuff in there, but nothing I needed. |
Sorry. We get a lot of issues, and it's hard to keep up. If the prerequisites don't apply, it would help if you included a message stating that, and why next time. I am unable to use the code snippet you provided, since I'm on Windows, but just logging out |
My method for seeing the output of that method is a little roundabout, so I'll try that. |
I hacked the init script to print what the method returns after the editor is saved. It worked, which seems really weird. Let me work on my tool for a bit and get back to you. |
Right, so the init script printing that on editor save worked like a charm. However, I hacked the addon so that the path variable (which I set to the output of that method call) is printed when I run the command. I got undefined. The code (more or less) is in https://github.com/ysgard/d-struct/blob/master/lib/d-struct.coffee. I'm wondering why the method works in one place but not in the other. |
Ok, looking at your code, it looks like you instantiate Since this is starting to look like a code issue, would you mind creating a topic on Discuss, the official Atom and Electron message board instead? We should be able to help you better there. |
That makes sense. However, I don't think this is the case. The version of that file that I'm running is echoing the direct result of that method, so I don't think it's a programming error, even if that will be an issue. I can fix that later. My topic on the forum: https://discuss.atom.io/t/getpaths-issues/39996 |
This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks! |
Prerequisites
I did not do this in safe mode, since I don't know of anything that prints the project path without an addon of some kind.
I read through the FAQ's and Debugging guide.
This is for a package that I am helping to maintain.
Description
The getPaths() method from the projects API is not functioning on Ubuntu 16.04. I am trying to extend an extension that does some things with project paths, and I've narrowed my troubles down to this method. I've hacked the extension that I'm working on so that when I run an atom command, it executes this line of bash script (This is actually a bit of coffee):
"gnome-terminal -e \"bash -ic \'echo #{atom.project.getPaths().shift()} && read -s -n 1 line\'\""
It's a little complicated, with a number of escape sequences, so I'll explain it here.
The
gnome-terminal
command runs all of the following using the -e option (this also works with xterm, although I've set my personal (and hacked) copy to gnome, since I prefer it).bash
is run so that the terminal actually shows up, rather than just running without opening a gui at all. This corresponds to the read statement at the end (see below)The
echo
bit is just the bit that I hacked so that it would print the string it's supposed to be cd'ing to instead of trying, failing, and closing. Eventually it will cd to that path, and then execute something in there, but that isn't particularly relevant.read
(and all of it's args) is so that the terminal stays open so that you can see the output.This all works great, I can see the output of getPaths() just fine. The problem is the output itself:
undefined
. Removing the .shift() property makes the method return nothing at all. I'm wondering if anyone else is having this problem (all platforms, I'm curious), and wondering why I'm having this issue (I am restarting atom every time I edit the file...).Steps to Reproduce
Expected behavior: I want it to spit out the project I'm currently working in.
Actual behavior: It prints
undefined
Reproduces how often: 100% of the time this is the case. I am led to believe that this is not the case on other platforms.
Versions
atom --version
:Atom : 1.14.2
Electron: 1.3.13
Chrome : 52.0.2743.82
Node : 6.5.0
apm --version
:apm 1.15.3
npm 3.10.5
node 4.4.5 x64
python 2.7.11+
git 2.7.4
Like I mentioned before, I'm running a release version of Ubuntu Linux 16.04 LTS 64 bit. Let me know if you need any more info.
The text was updated successfully, but these errors were encountered: