Tôi đang cố gắng thiết lập IDE Notepad ++ để khi tôi nhấn F6 tập lệnh Ruby tôi đang chỉnh sửa sẽ chạy. Sau khi tìm kiếm trên internet, tôi thấy rằng việc đặt cmd /K ruby "$(FULL_CURRENT_PATH)"
vào hộp thoại chạy bật lên khi tôi nhấn F5 sẽ chạy các tập lệnh cơ bản trong Command Prompt (Tôi đang sử dụng Windows 7). Tuy nhiên, nếu mã của tôi tải bất kỳ dữ liệu bên ngoài nào như tệp .txt hoặc như tôi đã tìm thấy với Gosu, tải bất kỳ tệp hình ảnh nào, Ruby phàn nàn rằng mọi thứ không tồn tại thực tế tồn tại.Làm cách nào để thiết lập lệnh chạy Notepad ++ cho Ruby?
Tôi biết mã của tôi và cài đặt Ruby (Ruby 1.9.3) là tốt vì trước đây tôi đã sử dụng FreeRIDE, IDE cũ hơn, hơi lỗi mà tôi đã mệt mỏi và mã của tôi chạy tốt khi Tôi nhấn F5 sử dụng IDE đó.
Một số ví dụ về khiếu nại tuân theo.
chữ My phiêu lưu:
C:/Users/Estanislao/Dropbox/Allway Sync/My Important Documents/Text Focused Fold
er/Ruby Scripts/Text Adventure/0.1.0/File Parser/DungeonContentFileParser.rb:8:i
n `initialize': No such file or directory - Example Dungeon Creator File.txt (Er
rno::ENOENT)
from C:/Users/Estanislao/Dropbox/Allway Sync/My Important Documents/Text
Focused Folder/Ruby Scripts/Text Adventure/0.1.0/File Parser/DungeonContentFile
Parser.rb:8:in `open'
from C:/Users/Estanislao/Dropbox/Allway Sync/My Important Documents/Text
Focused Folder/Ruby Scripts/Text Adventure/0.1.0/File Parser/DungeonContentFile
Parser.rb:8:in `encapsulate_method'
from C:/Users/Estanislao/Dropbox/Allway Sync/My Important Documents/Text
Focused Folder/Ruby Scripts/Text Adventure/0.1.0/File Parser/DungeonContentFile
Parser.rb:117:in `sort_room_data_external_method'
from C:/Users/Estanislao/Dropbox/Allway Sync/My Important Documents/Text
Focused Folder/Ruby Scripts/Text Adventure/0.1.0/File Parser/DungeonContentFile
Parser.rb:125:in `<main>'
D:\Programming Stuff\Notepad++>
Chương trình My Gosu:
C:/Users/Estanislao/Dropbox/Allway Sync/My Important Documents/Text Focused Fold
er/Ruby Scripts/Game Development/Circular Motion.rb:10:in `initialize': Could no
t load image media/Space2.png using either GDI+ or FreeImage: Unknown error (Run
timeError)
from C:/Users/Estanislao/Dropbox/Allway Sync/My Important Documents/Text
Focused Folder/Ruby Scripts/Game Development/Circular Motion.rb:10:in `new'
from C:/Users/Estanislao/Dropbox/Allway Sync/My Important Documents/Text
Focused Folder/Ruby Scripts/Game Development/Circular Motion.rb:10:in `initiali
ze'
from C:/Users/Estanislao/Dropbox/Allway Sync/My Important Documents/Text
Focused Folder/Ruby Scripts/Game Development/Circular Motion.rb:181:in `new'
from C:/Users/Estanislao/Dropbox/Allway Sync/My Important Documents/Text
Focused Folder/Ruby Scripts/Game Development/Circular Motion.rb:181:in `<main>'
D:\Programming Stuff\Notepad++>
Nếu bất cứ ai có thể cho vay bất kỳ sự giúp đỡ nào cả Tôi thực sự muốn đánh giá cao nó.
Cập nhật: đề xuất của knut đã cho phép tôi nhận được những gì tôi muốn sau một số bất tiện khi tung hứng mỗi lần tôi bắt đầu chương trình. Có một vài vấn đề. Sử dụng
cmd /K "cd "$(CURRENT_DIRECTORY)" && ruby "$(FULL_CURRENT_PATH)""
trong đối thoại chạy mặc định không hoạt động. (Tôi nhận được khiếu nại tương tự như trên.) Nhưng sử dụng NppExec và
cd "$(CURRENT_DIRECTORY)"
ruby "$(FULL_CURRENT_PATH)"
cho rằng hoạt động tốt, ngoại trừ với mã Gosu của tôi, mà nên vẽ một cửa sổ và animate một số hình ảnh, không có gì xảy ra. Tuy nhiên, nếu mỗi lần tôi khởi động Notepad ++ tôi chạy NppExec và sau đó sử dụng cuộc đối thoại chạy mặc định, mọi thứ hoạt động chính xác bằng cách sử dụng lệnh chạy được xây dựng trong phiên đó. Bất kỳ ý tưởng nào về lý do tại sao tất cả điều này xảy ra và cách ngăn chặn nó? Ngoài ra, tôi muốn có Notepad + + mở một cửa sổ Command Prompt thay vì chạy bên trong Notepad ++ chính nó, như nó với NppExec. Và cảm ơn!
Update2: Dường như việc khởi động lại máy tính của tôi đã giải quyết được vấn đề, nhưng bây giờ tôi thấy bối rối hơn về những gì đang thực sự xảy ra. Có phải plugin NppExec thực sự cho phép mọi thứ hoạt động như tôi muốn, mặc dù tôi đang sử dụng tập lệnh đã lưu cho hộp thoại chạy mặc định? Hoặc Đây có phải là lỗi không, giữ nguyên
cmd /K "cd "$(CURRENT_DIRECTORY)" && ruby "$(FULL_CURRENT_PATH)""
làm việc cho đến khi tôi khởi động lại?
dấu phẩy 'cd' cũng nên sử dụng công tắc'/D'. nếu không nó sẽ chỉ hoạt động nếu tập tin hiện tại là trên cùng một ổ đĩa như notepad! để lệnh đầy đủ là: "cmd/K" cd/D "$ (CURRENT_DIRECTORY)" && ruby "$ (FILE_NAME)" "' –