Compare commits

...

16 Commits

Author SHA1 Message Date
Julian Ospald 676cc3964a
Skip build with 7.8.4, which has annoying failures 2016-05-30 14:40:23 +02:00
Julian Ospald d13019bc83
Fix base and cabal version constraints 2016-05-30 14:40:03 +02:00
Julian Ospald 93cfdaa6a7
Update HACKING.md 2016-05-30 14:37:15 +02:00
Julian Ospald d1432c206b
Fix build for ghc < 7.10 2016-05-30 14:20:00 +02:00
Julian Ospald 6839715e96
Fix travis 2016-05-30 13:56:02 +02:00
Julian Ospald e900b690e7
Fix build with older GHC < 7.10 2016-05-30 13:52:37 +02:00
Julian Ospald ba398d348e
Fix travis 2016-05-30 13:31:08 +02:00
Julian Ospald 0e12d4c452
Fix travis 2016-05-30 13:30:22 +02:00
Julian Ospald af95c1ecfb
Fix travis 2016-05-30 13:18:56 +02:00
Julian Ospald f6a9c46c9a
Fix travis 2016-05-30 13:18:00 +02:00
Julian Ospald 588207f44b
Fix travis 2016-05-30 13:15:11 +02:00
Julian Ospald f2eca58b5d
Require cabal >= 1.24 2016-05-30 13:05:14 +02:00
Julian Ospald 723042d9b9
Fix .cabal file
This fixes 'cabal check' warnings.
2016-05-30 12:39:49 +02:00
Julian Ospald 219b4a7ebb
Fix travis build 2016-05-30 12:18:32 +02:00
Julian Ospald 42afd6983e
Not that experimental anymore 2016-05-30 01:08:27 +02:00
Julian Ospald 5266c9d2b4
Add travis 2016-05-30 01:03:29 +02:00
9 changed files with 86 additions and 21 deletions

55
.travis.yml Normal file
View File

@ -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

View File

@ -1,7 +1,7 @@
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.

View File

@ -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")
* 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
based. Some provide dedicated `Foo.ByteString` modules though, but it
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
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
* 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
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.
* 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
In addition, we don't use the `directory` package, which is dangerous
and broken. Instead, we implement our own low-level wrappers around
the posix functions, so we have proper control over the internals
and know the possible exceptions.
and broken. Instead, we use the [HPath.IO](https://hackage.haskell.org/package/hpath/docs/HPath-IO.html).
### 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
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
`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
functions like `bracket` directly in our low-level code in case

View File

@ -10,7 +10,7 @@ copyright: Copyright: (c) 2016 Julian Ospald
homepage: https://github.com/hasufell/hsfm
category: Desktop
build-type: Simple
cabal-version: >=1.10
cabal-version: >=1.24
data-files:
LICENSE
@ -30,7 +30,7 @@ library
HSFM.Utils.MyPrelude
build-depends:
base >= 4.7,
base >= 4.8 && < 5,
bytestring,
data-default,
filepath >= 1.3.0.0,
@ -48,10 +48,7 @@ library
FlexibleInstances
ViewPatterns
ghc-options:
-O2
-threaded
-Wall
"-with-rtsopts=-N"
executable hsfm-gtk
main-is: HSFM/GUI/Gtk.hs
@ -69,8 +66,8 @@ executable hsfm-gtk
HSFM.Utils.MyPrelude
build-depends:
Cabal >= 1.22.0.0,
base >= 4.7,
Cabal >= 1.24.0.0,
base >= 4.8 && < 5,
bytestring,
data-default,
filepath >= 1.3.0.0,
@ -97,8 +94,9 @@ executable hsfm-gtk
FlexibleInstances
ViewPatterns
ghc-options:
-O2
-threaded
-Wall
"-with-rtsopts=-N"
source-repository head
type: git
location: https://github.com/hasufell/hsfm

View File

@ -21,6 +21,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module HSFM.GUI.Gtk.Dialogs where
import Control.Applicative
(
(<$>)
)
import Control.Exception
(
displayException

View File

@ -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.
--}
{-# LANGUAGE DeriveDataTypeable #-}
{-# OPTIONS_HADDOCK ignore-exports #-}
-- |Provides error handling for Gtk.

View File

@ -22,6 +22,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module HSFM.GUI.Gtk.Icons where
import Control.Applicative
(
(<$>)
)
import Data.Maybe
(
fromJust

View File

@ -21,6 +21,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module HSFM.GUI.Gtk.MyView where
import Control.Applicative
(
(<$>)
)
import Control.Concurrent.MVar
(
newEmptyMVar

View File

@ -21,6 +21,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module HSFM.GUI.Gtk.Utils where
import Control.Applicative
(
(<$>)
)
import Control.Concurrent.MVar
(
readMVar