더블클릭으로 실행하면 nwJS는 open 이벤트의 매개변수로 "chromium-args"의 내용이 추가된 문자열과 더블클릭된 파일 경로를 전달해 준다.
정상적인 매개변수 문자열은 다음과 같아야한다.
"... /Jik-ji Editor.exe" --disable-features=nw2 ...(chromium-args 옵션 문자열)... "더블클릭된 파일 경로"
하지만 문제가 발생할때 로그는 다음과 같이 뒷부분의 문자열이 깨진 상태로 전달된다.
문제 원인
매개변수 문자열이 깨진 상태로 전달되므로 더블클릭된 파일 경로를 파싱할 수 없기 때문에 실행 명령이 중단된다.
이 문제는 nwJS에서 chromium-args 내용을 처리할때 발생하는 버그일 가능성이 높다.
chromium-args 내용이 약 256글자 이내이면 옵션 내용과 관계없이 정상동작하는 것을 확인하였다.
글자가 깨지는 것은 한글 문제와 관련이 없고 데이터의 길이 문제인것으로 추측된다.
이 문제는 글자가 깨지는 위치에 따라 간헐적으로 발생한다.
이슈 내용
더블클릭으로 저작도구 관련 파일들을 실행하고자 할때 저작도구가 포커싱을 받기는 하나 실행하지는 않는 현상이 있음
재연 방법
jjc, jjs, jjt, jik
파일등을 더블클릭으로 실행한다.디버깅
디버깅 창에서 nw.App open 이벤트를 통해 로그를 확인해 보면 다음과 같이 문자열이 깨짐으로 인해 파일 경로를 확인할 수 없는 현상이 확인되었다.
위 코드에서 argString 내용 중 exe 파일 경로 뒤에 따라오는 옵션들은
package.json
파일에서 설정된chromium-args
항목 내용들이며 원본은 다음과 같다.더블클릭으로 실행하면 nwJS는
open
이벤트의 매개변수로 "chromium-args"의 내용이 추가된 문자열과 더블클릭된 파일 경로를 전달해 준다.정상적인 매개변수 문자열은 다음과 같아야한다.
하지만 문제가 발생할때 로그는 다음과 같이 뒷부분의 문자열이 깨진 상태로 전달된다.
문제 원인
매개변수 문자열이 깨진 상태로 전달되므로 더블클릭된 파일 경로를 파싱할 수 없기 때문에 실행 명령이 중단된다.
해결
chromium-args
항목의 내용이 너무 길경우 File Association (더블 클릭) 기능 실행시 글자 깨짐이 발생하므로chromium-args
설정을 사용하지 않고NW_PRE_ARGS
환경변수를 사용하여 버그를 우회한다. (https://docs.nwjs.io/en/latest/References/Command%20Line%20Options/#environment-variables)launcher에서 exe를 실행할때 환경 변수로 지정해 주면
NW_PRE_ARGS
값은chromium-args
값 앞에 자동으로 붙어 전달된다.매개변수가 정상적으로 전달됨을 확인함.