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

Windows #261

Open
wants to merge 76 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
5772c9f
Windows build
robert-nix Jun 1, 2016
f6b8528
Windows process execution
refi64 Aug 24, 2016
a67a388
Make process termination work
refi64 Aug 24, 2016
6f61ce1
Remove aux.moon (for now, at least)
refi64 Aug 24, 2016
dfc31cb
Update theme fonts to have Windows-friendly versions
refi64 Aug 24, 2016
eda9cdd
Update .gitignore
refi64 Aug 24, 2016
4a4a842
Make icons work
refi64 Aug 24, 2016
26dc5c3
Clean up some debugging aids
refi64 Aug 24, 2016
588dd69
On Windows, printing a message will leave it in the buffer until the …
refi64 Aug 24, 2016
0e91553
Tweak Windows default fonts
refi64 Aug 24, 2016
4222bd9
Fix tmpfile on Windows
refi64 Aug 24, 2016
5509fe7
Fix a LOT of test failures related to howl.io.File and Windows
refi64 Aug 24, 2016
bce797f
Fix a minor bug in File.etag
refi64 Aug 24, 2016
306976f
More spec fixes
refi64 Aug 24, 2016
bf1d7f3
Some cleanup
refi64 Aug 24, 2016
87f82a5
I AM AN IDIOT.
refi64 Aug 24, 2016
8bd1c80
Typo fix
refi64 Aug 24, 2016
8ba523c
Test fixes
refi64 Aug 24, 2016
9b65e03
More test fixes
refi64 Aug 24, 2016
05a84ab
Fix several path_spec test failures
refi64 Aug 24, 2016
0f09ac6
Fix a bug in File.is_absolute and more paths specs
refi64 Aug 24, 2016
20d2c4b
Fix a bug in OutputStream under Windows
refi64 Aug 24, 2016
d698bb6
Some fixes for process signals
refi64 Aug 24, 2016
376aa90
Process fixes
refi64 Aug 24, 2016
0864b60
Fix the sandboxed loader specs
refi64 Aug 24, 2016
5a68550
Fix project_spec under Windows
refi64 Aug 25, 2016
7f59fb2
Fix buffer_spec on Windows
refi64 Aug 25, 2016
b7b0638
Fixes to file selector interactions and specs
refi64 Aug 25, 2016
7f12ca1
Make file opening a bit more natural under Windows
refi64 Aug 25, 2016
443639b
More file selection on Windows
refi64 Aug 25, 2016
f4fcd0a
Windows specs
refi64 Aug 25, 2016
017566d
Simply tempfile code
refi64 Aug 25, 2016
b8d269b
More file selection fixes
refi64 Aug 25, 2016
7eb58c3
Finish fixing the file_selection specs
refi64 Aug 25, 2016
173ad8c
Hidden file reorg & make bundle_spec pass on Windows
refi64 Aug 25, 2016
38796e1
Un-break stuff
refi64 Aug 25, 2016
e0617cb
Shut up, linter
refi64 Aug 25, 2016
9cd8d6c
Update Makefile for MSYS2
refi64 Aug 26, 2016
843a404
More process fixes
refi64 Aug 26, 2016
ccc8bb8
More spec fixes
refi64 Aug 30, 2016
7c628a0
Fix scrollbar on an empty file
refi64 Aug 30, 2016
11fe38d
Process spec fixes
refi64 Sep 28, 2016
9e1f472
More spec fixes
refi64 Sep 28, 2016
cc28ed6
PROCESS. SPECS. WORK.
refi64 Sep 28, 2016
5e32023
Fix glib specs
refi64 Sep 28, 2016
4d1437d
Fix the definition of g_object_new
refi64 Sep 29, 2016
40be07b
gio test fixes
refi64 Sep 29, 2016
6dff5ca
More spec fixes
refi64 Sep 29, 2016
c7260e0
More spec fixes
refi64 Sep 29, 2016
941a91f
Cleanup
refi64 Sep 29, 2016
9894693
Linter
refi64 Sep 29, 2016
fd7f577
Mrgrgr...
refi64 Sep 29, 2016
285242e
*facepalm*
refi64 Sep 29, 2016
734e348
Linux fixes
refi64 Sep 29, 2016
5647ae0
Fixes
refi64 Sep 29, 2016
277b252
Fixes
refi64 Sep 29, 2016
41fccbe
More spec fixes
refi64 Sep 29, 2016
f48895d
More spec fixes
refi64 Sep 29, 2016
e1b48c9
Docs
refi64 Sep 29, 2016
44c5029
Cleanup
refi64 Sep 30, 2016
b4a12a7
Null termination
refi64 Sep 30, 2016
d9f072d
Move g_usleep to cdefs
refi64 Sep 30, 2016
537e967
Fixes & more cleanup
refi64 Sep 30, 2016
e800c94
Fix path to cmd.exe
refi64 Sep 30, 2016
67afdb6
Write font loading failure to stderr
refi64 Sep 30, 2016
ff37594
Cleanup
refi64 Nov 5, 2016
2536cd7
Move some platform-specific code to howl.sys.platform
refi64 Nov 6, 2016
2dba2b2
Linter fixes
refi64 Nov 6, 2016
6b4ae52
Oops
refi64 Nov 6, 2016
81186cb
boring stuffz
refi64 Apr 28, 2017
67bf2fd
Add 'make windist'
refi64 Apr 28, 2017
c1e4c98
Rename ljglibs.aux -> ljglibs.util
refi64 Apr 28, 2017
decaa9a
Installer stuff
refi64 Apr 28, 2017
21f5742
*facepalm
refi64 Apr 28, 2017
f94c148
Windows docs
refi64 Apr 28, 2017
32a24f2
Merge branch 'master' of https://github.com/howl-editor/howl into win…
refi64 Jul 18, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
src/deps/*
src/deps/*/*
src/*.o
src/howl
src/howl.exe
src/howl.ico
src/howl.png
src/howl.res
src/windist
src/wininst
*.bc
*.bak
site/build/
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ how to install Howl from source.
based system).
- `C compiler`: Howl has a very small C core itself, and it embeds
dependencies written in C.
- If you're using Windows, you *need* to build Howl inside of
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could/should we add a specific README with installation instructions on Windows? I'm thinking of basic steps from start to finish.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be in a readme (e.g. README.windows.md), or do you think it would be better as a page on the site (e.g. getit.windows.html), as a parallel to getit.html?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a separate page on the site would be best, we could just reference to that from the README.

[MSYS2](https://msys2.github.io/)'s MinGW32 shell.

### Build && install

Expand Down
10 changes: 7 additions & 3 deletions bundles/git/spec/git_spec.moon
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import bundle, config, VC from howl
import File from howl.io

echo = if jit.os == 'Windows'
"#{howl.sys.env.WD}echo.exe"
else
'/bin/echo'

describe 'Git bundle', ->
setup -> bundle.load_by_name 'git'
teardown -> bundle.unload 'git'
Expand All @@ -26,8 +31,7 @@ describe 'Git bundle', ->
assert.equal instance.root, dir

it 'returns nil if no git root was found', ->
File.with_tmpfile (file) ->
assert.is_nil git_vc.find file
assert.is_nil git_vc.find howl.io.File echo

describe 'A Git instance', ->
root = nil
Expand Down Expand Up @@ -106,7 +110,7 @@ describe 'Git bundle', ->

it 'uses the executable in variable `git_path` if specified', (done) ->
howl_async ->
config.git_path = '/bin/echo'
config.git_path = echo
status, out = pcall git.run, git, 'using echo'
config.git_path = nil
assert status, out
Expand Down
2 changes: 1 addition & 1 deletion bundles/howl-themes/solarized_light/solarized_light.moon
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ return {
font:
bold: true
size: 'large'
family: 'Purisa,Latin Modern Sans'
family: 'Purisa,Comic Sans,Latin Modern Sans,Lucida Sans Unicode'

definition: color: yellow
function: color: blue
Expand Down
2 changes: 1 addition & 1 deletion bundles/howl-themes/steinom/steinom.moon
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ return {
font:
bold: true
size: 'large'
family: 'Purisa,Latin Modern Sans'
family: 'Purisa,Comic Sans,Latin Modern Sans,Lucida Sans Unicode'

definition: color: yellow

Expand Down
2 changes: 1 addition & 1 deletion bundles/howl-themes/tomorrow_night_blue/tm_night_blue.moon
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ return {
font:
bold: true
size: 'large'
family: 'Purisa,Latin Modern Sans'
family: 'Purisa,Comic Sans,Latin Modern Sans,Lucida Sans Unicode'

definition: color: yellow

Expand Down
2 changes: 1 addition & 1 deletion lib/aullar/gutter.moon
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{:define_class} = require 'aullar.util'
Pango = require 'ljglibs.pango'
{:RGBA} = require 'ljglibs.gdk'
Background = require 'ljglibs.aux.background'
Background = require 'ljglibs.util.background'
Layout = Pango.Layout
pango_cairo = Pango.cairo

Expand Down
7 changes: 6 additions & 1 deletion lib/aullar/view.moon
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,14 @@ View = {

if opts.vertical
page_size = @lines_showing - 1
upper = @buffer.nr_lines
if page_size == 0
-- GtkRange docs mention that page_size is normally >0 for GtkScrollbar
upper = 2
page_size = 1
adjustment = @vertical_scrollbar.adjustment
if adjustment
adjustment\configure @first_visible_line, 1, @buffer.nr_lines, 1, page_size, page_size
adjustment\configure @first_visible_line, 1, upper, 1, page_size, page_size

if opts.horizontal
max_width = 0
Expand Down
9 changes: 0 additions & 9 deletions lib/howl/aux.moon

This file was deleted.

3 changes: 3 additions & 0 deletions lib/howl/cdefs/init.moon
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ int sig_PWR;
int sig_SYS;
]]

if ffi.os == 'Windows'
require 'howl.cdefs.windows'

return {
const_char_p: ffi.typeof 'const char *'
char_p: ffi.typeof 'char *'
Expand Down
21 changes: 21 additions & 0 deletions lib/howl/cdefs/windows.moon
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- Copyright 2016 The Howl Developers
-- License: MIT (see LICENSE.md at the top-level directory of the distribution)

ffi = require 'ffi'

ffi.cdef [[
typedef void* HANDLE;
typedef void* PVOID;
typedef int DWORD;
typedef int BOOL;
typedef char* LPTSTR;
typedef const char* LPCTSTR;

DWORD GetProcessId(HANDLE process);
HANDLE _get_osfhandle(int fd);
BOOL TerminateProcess(HANDLE process, unsigned int exitcode);
int AddFontResourceExA(LPCTSTR lpszFilename, DWORD fl, PVOID pdv);
BOOL SetFileAttributesA(LPCTSTR file, DWORD attrs);

int fr_private;
]]
2 changes: 1 addition & 1 deletion lib/howl/commands/app_commands.moon
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ command.register
-----------------------------------------------------------------------

launch_cmd = (working_directory, cmd) ->
shell = howl.sys.env.SHELL or '/bin/sh'
shell = howl.sys.env.SHELL
p = Process {
:cmd,
:shell,
Expand Down
8 changes: 6 additions & 2 deletions lib/howl/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Where options can be any of:
]=]

local path_separator = jit.os == 'Windows' and '\\' or '/'
local path_prefix = jit.os == 'Windows' and '\\\\.\\' or ''
app_root = path_prefix .. app_root

local function parse_args(arg_vector)
local options = {
Expand Down Expand Up @@ -168,12 +170,14 @@ local function main()
set_package_path('lib', 'lib/ext', 'lib/ext/moonscript')
require 'howl.moonscript_support'
table.insert(package.loaders, 2, bytecode_loader())
require 'howl.cdefs.fontconfig'
ffi.C.FcConfigAppFontAddDir(nil, table.concat({app_root, 'fonts'}, path_separator))
require 'ljglibs.cdefs.glib'

howl = auto_module('howl')
require('howl.globals')

local font_dir = table.concat({app_root, 'fonts'}, path_separator)
require('howl.sys').platform.load_font_dir(font_dir)

_G.log = require('howl.log')
local args = parse_args(argv)

Expand Down
15 changes: 11 additions & 4 deletions lib/howl/interactions/file_selection.moon
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ class FileSelector
parent or= File.home_dir

path = @command_line\pop_spillover!
-- Make / work on Windows.
path = path\gsub '/', File.separator

if path.is_empty
path = tostring(parent) .. '/'
path = tostring(parent) .. File.separator
else
trailing = path\ends_with('/') and '/' or ''
trailing = path\ends_with(File.separator) and File.separator or ''
path = tostring parent / path
if not path\ends_with '/'
if not path\ends_with File.separator
path ..= trailing

directory, unmatched = get_dir_and_leftover path
Expand Down Expand Up @@ -93,7 +95,12 @@ class FileSelector
on_update: (text) =>
return if @submitting

path = @directory.path .. '/' .. text
-- This allows one to use / as a directory separator, even on Windows.
text = text\gsub '/', File.separator
path = if File.is_absolute text
text
else
@directory.path .. File.separator .. text
directory, text = get_dir_and_leftover path

if directory != @directory
Expand Down
11 changes: 6 additions & 5 deletions lib/howl/io/file.moon
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ GFile = require 'ljglibs.gio.file'
GFileInfo = require 'ljglibs.gio.file_info'
glib = require 'ljglibs.glib'
import PropertyObject from howl.util.moon
import platform from howl.sys
append = table.insert

file_types = {
Expand All @@ -19,12 +20,12 @@ file_types = {
class File extends PropertyObject

tmpfile: ->
file = File assert os.tmpname!
file.touch if not file.exists
file = File platform.tmpname!
file\touch! if not file.exists
file

tmpdir: ->
with File os.tmpname!
with File platform.tmpname!
\delete! if .exists
\mkdir!

Expand All @@ -35,7 +36,7 @@ class File extends PropertyObject
error err if not status

is_absolute: (path) ->
(path\match('^/') or path\match('^%a:\\\\')) != nil
(path\match('^/') or path\match('^%a:\\')) != nil

expand_path: (path) ->
res = path\gsub "~#{File.separator}", File.home_dir.path .. File.separator
Expand Down Expand Up @@ -79,7 +80,7 @@ class File extends PropertyObject
@property size: get: => @_info!.size
@property exists: get: => @gfile.exists
@property readable: get: => @exists and @_info('access')\get_attribute_boolean 'access::can-read'
@property etag: get: => @exists and @_info('etag').etag
@property etag: get: => @exists and @_info('etag').etag or nil
@property modified_at: get: => @exists and @_info('time')\get_attribute_uint64 'time::modified'
@property short_path: get: => @path\gsub "^#{File.home_dir.path}", '~'

Expand Down
6 changes: 4 additions & 2 deletions lib/howl/io/input_stream.moon
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@

dispatch = howl.dispatch
glib = require 'ljglibs.glib'
{:UnixInputStream} = require 'ljglibs.gio'
{:Win32InputStream, :UnixInputStream} = require 'ljglibs.gio'
{:PropertyObject} = howl.util.moon
{:platform} = howl.sys
append = table.insert

class InputStream extends PropertyObject
new: (@stream, @priority = glib.PRIORITY_LOW) =>
@stream = UnixInputStream(@stream) if type(@stream) == 'number'
if type(@stream) == 'number'
@stream = platform.fd_to_stream Win32InputStream, UnixInputStream, @stream
super!

@property is_closed: get: => @stream.is_closed
Expand Down
5 changes: 3 additions & 2 deletions lib/howl/io/output_stream.moon
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
-- License: MIT (see LICENSE.md at the top-level directory of the distribution)

dispatch = howl.dispatch
{:UnixOutputStream} = require 'ljglibs.gio'
{:Win32OutputStream, :UnixOutputStream} = require 'ljglibs.gio'
{:PropertyObject} = howl.util.moon
{:platform} = howl.sys

class OutputStream extends PropertyObject
new: (fd) =>
@stream = UnixOutputStream fd
@stream = platform.fd_to_stream Win32OutputStream, UnixOutputStream, fd
super!

@property is_closed: get: => @stream.is_closed
Expand Down
15 changes: 11 additions & 4 deletions lib/howl/io/process.moon
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ jit = require 'jit'
callbacks = require 'ljglibs.callbacks'
dispatch = howl.dispatch
{:File, :InputStream, :OutputStream} = howl.io
{:platform} = howl.sys

C, ffi_cast = ffi.C, ffi.cast
append = table.insert
Expand Down Expand Up @@ -36,11 +37,16 @@ shell_quote = (s) ->
else
s

get_command = (v, shell = '/bin/sh') ->
get_command = (v, shell = platform.default_shell!) ->
t = type v

if t == 'string'
return { shell, '-c', v }, v
arg = if shell\find 'cmd.exe'
-- Likely cmd.exe.
'/C'
else
'-c'
return { shell, arg, v }, v
elseif t != 'table'
return nil

Expand Down Expand Up @@ -108,6 +114,7 @@ class Process
@argv, @command_line = get_command opts.cmd, opts.shell
error 'opts.cmd missing or invalid', 2 unless @argv
@_process = launch @argv, opts
@true_pid = @_process.true_pid
@pid = @_process.pid
@working_directory = File opts.working_directory or get_current_dir!
@stdin = OutputStream(@_process.stdin_pipe) if @_process.stdin_pipe
Expand All @@ -118,7 +125,7 @@ class Process
@@running[@pid] = @

@_exit_handle = callbacks.register child_exited, "process-watch-#{@pid}", @
C.g_child_watch_add ffi_cast('GPid', @pid), child_watch_callback, callbacks.cast_arg(@_exit_handle.id)
C.g_child_watch_add ffi_cast('GPid', @true_pid), child_watch_callback, callbacks.cast_arg(@_exit_handle.id)

wait: =>
return if @exited
Expand All @@ -127,7 +134,7 @@ class Process

send_signal: (signal) =>
signal = signals[signal] if type(signal) == 'string'
C.kill(@pid, signal)
platform.send_signal @true_pid, signal

pump: (on_stdout, on_stderr) =>
if on_stdout and not @stdout
Expand Down
1 change: 1 addition & 0 deletions lib/howl/log.moon
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dispatch = (level, message) ->
command_line\notify essentials, level if command_line.showing
elseif not _G.howl.app.args.spec
_G.print message
_G.io.flush!

while #entries > config.max_log_entries and #entries > 0
table.remove entries, 1
Expand Down
Loading