Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working directory in Windows - cannot find apk #80

Open
KptnKMan opened this issue Nov 20, 2020 · 5 comments
Open

Working directory in Windows - cannot find apk #80

KptnKMan opened this issue Nov 20, 2020 · 5 comments

Comments

@KptnKMan
Copy link

KptnKMan commented Nov 20, 2020

Hi,
I'm encountering the following an error when I run sndcpy in any directory apart from its own working directory.

I run:

PS C:\Users\kptnkman> C:\\Programs\\sndcpy\\sndcpy 192.168.1.29:5555

I get:

Waiting for device 192.168.1.29:5555...
Performing Streamed Install
adb: failed to stat sndcpy.apk: No such file or directory
Uninstalling existing version first...
Failure [DELETE_FAILED_INTERNAL_ERROR]
Failed with error #1.
Press any key to continue . . .

If I run the same command from the actual directory:

PS C:\Users\kptnkman> cd C:\\Programs\\sndcpy
PS C:\Programs\sndcpy> C:\\Programs\\sndcpy\\sndcpy 192.168.1.29:5555

Then I get:

Waiting for device 192.168.1.29:5555...
Performing Streamed Install
Success
28200
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.rom1v.sndcpy/.MainActivity }
Warning: Activity not started, intent has been delivered to currently running top-most instance.
Press Enter once audio capture is authorized on the device to start playing...

It seems that the working directory is not set for the location to find the apk.
It looks for the sndcpy.apk in the directory of the environment, not its own directory (Eg ".\sndcpy.apk").

Any chance this can be fixed or is there a workaround?

Thanks.

@rom1v
Copy link
Owner

rom1v commented Nov 20, 2020

It seems that the working directory is not set for the location to find the apk.

Yes, by default it just pass adb install sndcpy.apk, which is in the current directory (not in the directory of your executable).

It looks for the sndcpy.apk in the directory of the environment

You can set a custom path SNDCPY_APK environement variable to the fullpath of your sndcpy.apk.

Any chance this can be fixed or is there a workaround?

Probably not in sndcpy, this is just a PoC. The workaround is to do what have been done on scrcpy for exactly this problem.

@KptnKMan
Copy link
Author

@rom1v hey man, with all due respect, I'm trying to help you so I created a PR to fix this here:
#81

I don't buy the answer of "this is just a PoC".

Please merge my PR, I made sure to tested it for Windows and Linux. 👍

@KptnKMan
Copy link
Author

Any chance this can be fixed or is there a workaround?

Probably not in sndcpy, this is just a PoC. The workaround is to do what have been done on scrcpy for exactly this problem.

Also, scrcpy does not have this issue when it is specified from a different directory.

I know this, because this is how I am launching scrcpy:

PS C:\Users\kptnkman> C:\\Programs\\scrcpy\\scrcpy.exe --crop 1600:900:2017:510 -b 8000000 --max-fps 72 --max-size 0 -n --window-title "SideQuest Stream" -s 192.168.1.29:5555
INFO: scrcpy 1.11 <https://github.com/Genymobile/scrcpy>
C:\Programs\scrcpy\scrcpy-server: 1 file pushed. 4.4 MB/s (25454 bytes in 0.006s)
INFO: Initial texture: 1600x896

Notice I am not in the scrcpy dir when launching it.

@rom1v
Copy link
Owner

rom1v commented Nov 20, 2020

Also, scrcpy does not have this issue when it is specified from a different directory.

Because it has been fixed in v1.9: Genymobile/scrcpy@2755bfc

@KptnKMan
Copy link
Author

Awesome, I'm happy it's fixed in scrcpy.
I'd really like it fixed here too. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants