Compare commits
16 Commits
Author | SHA1 | Date |
---|---|---|
Julian Ospald | 676cc3964a | |
Julian Ospald | d13019bc83 | |
Julian Ospald | 93cfdaa6a7 | |
Julian Ospald | d1432c206b | |
Julian Ospald | 6839715e96 | |
Julian Ospald | e900b690e7 | |
Julian Ospald | ba398d348e | |
Julian Ospald | 0e12d4c452 | |
Julian Ospald | af95c1ecfb | |
Julian Ospald | f6a9c46c9a | |
Julian Ospald | 588207f44b | |
Julian Ospald | f2eca58b5d | |
Julian Ospald | 723042d9b9 | |
Julian Ospald | 219b4a7ebb | |
Julian Ospald | 42afd6983e | |
Julian Ospald | 5266c9d2b4 |
|
@ -0,0 +1,55 @@
|
||||||
|
# See https://github.com/hvr/multi-ghc-travis for more information
|
||||||
|
|
||||||
|
language: c
|
||||||
|
|
||||||
|
sudo: required
|
||||||
|
dist: trusty
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- env: CABALVER=1.24 GHCVER=7.10.2
|
||||||
|
addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.2,libgtk2.0-dev,libgtk-3-dev], sources: [hvr-ghc]}}
|
||||||
|
- env: CABALVER=1.24 GHCVER=8.0.1
|
||||||
|
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,libgtk2.0-dev,libgtk-3-dev], sources: [hvr-ghc]}}
|
||||||
|
- env: CABALVER=head GHCVER=head
|
||||||
|
addons: {apt: {packages: [cabal-install-head,ghc-head,libgtk2.0-dev,libgtk-3-dev], sources: [hvr-ghc]}}
|
||||||
|
|
||||||
|
allow_failures:
|
||||||
|
- env: CABALVER=head GHCVER=head
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
|
||||||
|
|
||||||
|
install:
|
||||||
|
- cabal --version
|
||||||
|
- travis_retry cabal update
|
||||||
|
- cabal sandbox init
|
||||||
|
- cabal install alex happy
|
||||||
|
- export PATH="$(pwd)/.cabal-sandbox/bin:$PATH"
|
||||||
|
- cabal install gtk2hs-buildtools
|
||||||
|
- cabal install --only-dependencies --enable-tests -j
|
||||||
|
|
||||||
|
script:
|
||||||
|
- cabal configure --enable-tests -v2
|
||||||
|
- cabal build
|
||||||
|
- cabal test
|
||||||
|
- cabal check
|
||||||
|
- cabal sdist
|
||||||
|
# check that the generated source-distribution can be built & installed
|
||||||
|
- export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ;
|
||||||
|
cd dist/;
|
||||||
|
cabal sandbox init;
|
||||||
|
if [ -f "$SRC_TGZ" ]; then
|
||||||
|
cabal install alex happy;
|
||||||
|
export PATH="$(pwd)/.cabal-sandbox/bin:$PATH";
|
||||||
|
cabal install gtk2hs-buildtools;
|
||||||
|
cabal install "$SRC_TGZ" --enable-tests;
|
||||||
|
else
|
||||||
|
echo "expected '$SRC_TGZ' not found";
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
email:
|
||||||
|
- hasufell@posteo.de
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
HSFM
|
HSFM
|
||||||
====
|
====
|
||||||
|
|
||||||
__NOTE: This project is in a highly experimental state! Don't complain if it deletes your whole home directory. You should use a chroot, docker environment or similar for testing.__
|
[![Build Status](https://api.travis-ci.org/hasufell/hsfm.png?branch=master)](http://travis-ci.org/hasufell/hsfm)
|
||||||
|
|
||||||
A Gtk+:3 filemanager written in Haskell.
|
A Gtk+:3 filemanager written in Haskell.
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,8 @@ This leads to the following benefits:
|
||||||
* we can reason about filepaths and rely on them to be valid (don't confuse that with "they exist")
|
* we can reason about filepaths and rely on them to be valid (don't confuse that with "they exist")
|
||||||
* filepath functions like `(</>)` are now predictable and safe in contrast to the version from the `filepath` package
|
* filepath functions like `(</>)` are now predictable and safe in contrast to the version from the `filepath` package
|
||||||
|
|
||||||
|
The [hpath](https://hackage.haskell.org/package/hpath) library does exactly that for us.
|
||||||
|
|
||||||
The only problem with this approach is that most libraries are still String
|
The only problem with this approach is that most libraries are still String
|
||||||
based. Some provide dedicated `Foo.ByteString` modules though, but it
|
based. Some provide dedicated `Foo.ByteString` modules though, but it
|
||||||
might be necessary to fork libraries.
|
might be necessary to fork libraries.
|
||||||
|
@ -84,17 +86,10 @@ the call stack at point `b` in time, when the file information in memory
|
||||||
could already be out of date. There are two approaches to make this less
|
could already be out of date. There are two approaches to make this less
|
||||||
sucky:
|
sucky:
|
||||||
* use the hinotify library on GUI level to refresh the view (and the File representation in memory) whenever the contents of a directory changes
|
* use the hinotify library on GUI level to refresh the view (and the File representation in memory) whenever the contents of a directory changes
|
||||||
* when we stuff something into the copy buffer, it is not saved as type `File a`, but as `Path Abs`... when the operation is finalized via `runFileOp`, then the file at the given path is read and the copy/move/whatnot function carried out immediately
|
* when we stuff something into the copy buffer, it is not saved as type `File a`, but as `Path Abs`... when the operation is finalized then the file at the given path is read and the copy/move/whatnot function carried out immediately
|
||||||
|
|
||||||
This means we should only interact with the `HSFM.FileSystem.FileOperation`
|
|
||||||
module via the operation data types `FileOperation`, `Copy` and `Move` and
|
|
||||||
the `runFileOp` function. This doesn't completely solve the problem, but for
|
|
||||||
the rest we have to trust the posix functions to throw the proper exceptions.
|
|
||||||
|
|
||||||
In addition, we don't use the `directory` package, which is dangerous
|
In addition, we don't use the `directory` package, which is dangerous
|
||||||
and broken. Instead, we implement our own low-level wrappers around
|
and broken. Instead, we use the [HPath.IO](https://hackage.haskell.org/package/hpath/docs/HPath-IO.html).
|
||||||
the posix functions, so we have proper control over the internals
|
|
||||||
and know the possible exceptions.
|
|
||||||
|
|
||||||
### Exception handling
|
### Exception handling
|
||||||
|
|
||||||
|
@ -102,7 +97,7 @@ Exceptions are good. We don't want to wrap everything in Maybe/Either types
|
||||||
unless we want to handle failure immediately. Otherwise we need to make
|
unless we want to handle failure immediately. Otherwise we need to make
|
||||||
sure that at least at some point IOExceptions are caught and visualized
|
sure that at least at some point IOExceptions are caught and visualized
|
||||||
to the user. This is often done via e.g. `withErrorDialog` which catches
|
to the user. This is often done via e.g. `withErrorDialog` which catches
|
||||||
`IOException` and `FmIOException`.
|
`IOException` and [HPathIOException](https://hackage.haskell.org/package/hpath/docs/HPath-IO-Errors.html#t:HPathIOException).
|
||||||
|
|
||||||
It's also important to clean up stuff like filedescriptors via
|
It's also important to clean up stuff like filedescriptors via
|
||||||
functions like `bracket` directly in our low-level code in case
|
functions like `bracket` directly in our low-level code in case
|
||||||
|
|
18
hsfm.cabal
18
hsfm.cabal
|
@ -10,7 +10,7 @@ copyright: Copyright: (c) 2016 Julian Ospald
|
||||||
homepage: https://github.com/hasufell/hsfm
|
homepage: https://github.com/hasufell/hsfm
|
||||||
category: Desktop
|
category: Desktop
|
||||||
build-type: Simple
|
build-type: Simple
|
||||||
cabal-version: >=1.10
|
cabal-version: >=1.24
|
||||||
|
|
||||||
data-files:
|
data-files:
|
||||||
LICENSE
|
LICENSE
|
||||||
|
@ -30,7 +30,7 @@ library
|
||||||
HSFM.Utils.MyPrelude
|
HSFM.Utils.MyPrelude
|
||||||
|
|
||||||
build-depends:
|
build-depends:
|
||||||
base >= 4.7,
|
base >= 4.8 && < 5,
|
||||||
bytestring,
|
bytestring,
|
||||||
data-default,
|
data-default,
|
||||||
filepath >= 1.3.0.0,
|
filepath >= 1.3.0.0,
|
||||||
|
@ -48,10 +48,7 @@ library
|
||||||
FlexibleInstances
|
FlexibleInstances
|
||||||
ViewPatterns
|
ViewPatterns
|
||||||
ghc-options:
|
ghc-options:
|
||||||
-O2
|
|
||||||
-threaded
|
|
||||||
-Wall
|
-Wall
|
||||||
"-with-rtsopts=-N"
|
|
||||||
|
|
||||||
executable hsfm-gtk
|
executable hsfm-gtk
|
||||||
main-is: HSFM/GUI/Gtk.hs
|
main-is: HSFM/GUI/Gtk.hs
|
||||||
|
@ -69,8 +66,8 @@ executable hsfm-gtk
|
||||||
HSFM.Utils.MyPrelude
|
HSFM.Utils.MyPrelude
|
||||||
|
|
||||||
build-depends:
|
build-depends:
|
||||||
Cabal >= 1.22.0.0,
|
Cabal >= 1.24.0.0,
|
||||||
base >= 4.7,
|
base >= 4.8 && < 5,
|
||||||
bytestring,
|
bytestring,
|
||||||
data-default,
|
data-default,
|
||||||
filepath >= 1.3.0.0,
|
filepath >= 1.3.0.0,
|
||||||
|
@ -97,8 +94,9 @@ executable hsfm-gtk
|
||||||
FlexibleInstances
|
FlexibleInstances
|
||||||
ViewPatterns
|
ViewPatterns
|
||||||
ghc-options:
|
ghc-options:
|
||||||
-O2
|
|
||||||
-threaded
|
|
||||||
-Wall
|
-Wall
|
||||||
"-with-rtsopts=-N"
|
|
||||||
|
source-repository head
|
||||||
|
type: git
|
||||||
|
location: https://github.com/hasufell/hsfm
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
module HSFM.GUI.Gtk.Dialogs where
|
module HSFM.GUI.Gtk.Dialogs where
|
||||||
|
|
||||||
|
|
||||||
|
import Control.Applicative
|
||||||
|
(
|
||||||
|
(<$>)
|
||||||
|
)
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
(
|
(
|
||||||
displayException
|
displayException
|
||||||
|
|
|
@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
--}
|
--}
|
||||||
|
|
||||||
|
{-# LANGUAGE DeriveDataTypeable #-}
|
||||||
{-# OPTIONS_HADDOCK ignore-exports #-}
|
{-# OPTIONS_HADDOCK ignore-exports #-}
|
||||||
|
|
||||||
-- |Provides error handling for Gtk.
|
-- |Provides error handling for Gtk.
|
||||||
|
|
|
@ -22,6 +22,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
module HSFM.GUI.Gtk.Icons where
|
module HSFM.GUI.Gtk.Icons where
|
||||||
|
|
||||||
|
|
||||||
|
import Control.Applicative
|
||||||
|
(
|
||||||
|
(<$>)
|
||||||
|
)
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
(
|
(
|
||||||
fromJust
|
fromJust
|
||||||
|
|
|
@ -21,6 +21,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
module HSFM.GUI.Gtk.MyView where
|
module HSFM.GUI.Gtk.MyView where
|
||||||
|
|
||||||
|
|
||||||
|
import Control.Applicative
|
||||||
|
(
|
||||||
|
(<$>)
|
||||||
|
)
|
||||||
import Control.Concurrent.MVar
|
import Control.Concurrent.MVar
|
||||||
(
|
(
|
||||||
newEmptyMVar
|
newEmptyMVar
|
||||||
|
|
|
@ -21,6 +21,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
module HSFM.GUI.Gtk.Utils where
|
module HSFM.GUI.Gtk.Utils where
|
||||||
|
|
||||||
|
|
||||||
|
import Control.Applicative
|
||||||
|
(
|
||||||
|
(<$>)
|
||||||
|
)
|
||||||
import Control.Concurrent.MVar
|
import Control.Concurrent.MVar
|
||||||
(
|
(
|
||||||
readMVar
|
readMVar
|
||||||
|
|
Loading…
Reference in New Issue